Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Capture Timestamp of the form submitted

SnowUserDev
Tera Contributor

Hey Community

 

I have 4-5 different forms on service portal which are linked to each other, each of them behaves as a different stage on the service portal.

 

Now the task is as soon as 1 form is submitted or the state changes or user moves from one form to another it should capture the timestamp.

I have a timestamp field created in each field.

How can I achieve this.

 

Thanks

1 ACCEPTED SOLUTION

Danish Bhairag2
Tera Sage

Hi @SnowUserDev ,

 

Assuming you are talking about Record Producers over here. You can either create a BR on each table & whenever the stage is moved from one to another it must have certain field where it gets completed or something u can add that under the BR condition for eg state is completed then it should trigger after update. This way we make sure it just runs at that time only & updates proper time in Time stamp field.

 

Under advance u can write below script

 

current.time_stamp = new GlideDateTime();
current.update();

 

Thanks,

Danish

 

View solution in original post

6 REPLIES 6

AshishKM
Kilo Patron
Kilo Patron

Hi @SnowUserDev ,

You can trace the "updated [sys_updated_on]" field after form submit, you can set your custom timestamp field same as updated field.

 

-Thanks,

AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM ,

 

Thank u so much for replying.

If I map the updated field will it not update everytime if some changes are made?

 

I mean why if the user changes the form as draft

 

I just want to capture the time only when it moves to next stage or current form is closed complete

@SnowUserDev, i didn't mention about the state change condition because you already know that condition to apply. Avoid current.update(); Thanks for marking helpful. 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Danish Bhairag2
Tera Sage

Hi @SnowUserDev ,

 

Assuming you are talking about Record Producers over here. You can either create a BR on each table & whenever the stage is moved from one to another it must have certain field where it gets completed or something u can add that under the BR condition for eg state is completed then it should trigger after update. This way we make sure it just runs at that time only & updates proper time in Time stamp field.

 

Under advance u can write below script

 

current.time_stamp = new GlideDateTime();
current.update();

 

Thanks,

Danish