How do I set a date/time field to a future date/time using ATF in ServiceNow?

Tara Taylor
Tera Contributor

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

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

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:

find_real_file.png

Using a negative number sets a date in the future, so this would set resolved to two weeks from when the test is run.

View solution in original post

10 REPLIES 10

Brad Tilton
ServiceNow Employee
ServiceNow Employee

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:

find_real_file.png

Using a negative number sets a date in the future, so this would set resolved to two weeks from when the test is run.

Hi Brad ,

 

Is there a function which set 10 minutes or 20 minutes in future from the current time .

Something like gs.minutesAgo(-10) should work.

Thanx a lot .It worked .