Set current date as dynamic field value

Community Alums
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

MrMuhammad
Giga Sage

Hello -  try below as a value

javascript: gs.nowDateTime();

OR

javascript: new GlideDateTime();

 

If this is Date field NOT Date/Time then try below

javascript: new GlideDateTime().getDate();
Regards,
Muhammad

Updated above response to add third option.

Regards,
Muhammad

MrMuhammad
Giga Sage

The below thread is not a direct solution to your question but I am adding as a helpful material here, In addition to my above response.

Dynamic Date population in the Set Field Values in the Automated Test Framework (ATF)

Regards,
Muhammad

mr18
Tera Guru
Tera Guru

In the ATF, select the test step as 'Set Field Values' and try below

find_real_file.png

Select the field for which you want to set current date and time and use the code as 'javascript: gs.nowDateTime()'