We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Set current date as dynamic field value

Not applicable

I'm trying to use ATF to test the Change process, and when closing off the implementation phase I would like to use the current date set programatically, rather than having to set this manually before running the test. I don't seem to see any options for setting dynamic date/time values when setting up test steps, does anyone know if this is possible?

8 REPLIES 8

As I mentioned in my first response, for the Date field we need to use below

javascript: gs.nowDateTime().getDate();

without calling getDate() it will return Date and Time which will cause a problem here.

 

Regards,
Muhammad

If you will see my reply I have mentioned clearly which test step he has to use in order to do that

Ankur Bawiskar
Tera Patron

@Adam Domanski 

you should set the local date as below in the ATF test steo

javascript: new GlideDateTime().getLocalDate();

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader