- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2018 07:37 PM
Hi ServiceNow Gurus,
How do I populate a datetime field with the current datetime + 2 hours on submit in a UI Action?
Thank you very much.
Carlo
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2018 07:44 PM
var dt = new GlideDateTime(); dt.addSeconds(7200); current.setValue(‘u_your_field’, dt.getValue());
put the above in the script portion portion of your UI Action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2018 07:44 PM
var dt = new GlideDateTime(); dt.addSeconds(7200); current.setValue(‘u_your_field’, dt.getValue());
put the above in the script portion portion of your UI Action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2018 07:46 PM
Assuming your UI Action is Server Side:
current.dateTimeField = gs.hoursAgo(-2);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022