- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2019 01:19 PM
I am building an Automated test and having issues with a date/time field that is required. I need to fill it with a date/time that is always in the future of whenever I am running the test. I have seen several posts for this but none of the suggestions have worked for me. I am fairly new to ServiceNow so it definitely could be me. Any help is appreciated.
Thanks,
Tara
Solved! Go to Solution.
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2019 07:12 AM
Hi Tara,
The easiest way I've found to do this is to use something like gs.daysAgo() or gs.hoursAgo() in the date/time field like this:
Using a negative number sets a date in the future, so this would set resolved to two weeks from when the test is run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 03:25 AM
javascript:gs.nowDateTime() ---> todays date
javascript:gs.daysAgo(-5); --> future date
javascript:gs.daysAgo(+5); --> past date