In Servicenow ATF whenever i run the ATF by default i want to set the date as today's date

kranthi2
Tera Expert

Hi,

In Servicenow ATF whenever i run the ATF by default i want to set the date as today's date.

kranthi2_0-1714810266882.png

In the above screenshot if i run i am putting the date but if i run the same ATF after 10 days it will get error because whenever i run the ATF i want to put the today's date.

If any possibility please help me out on the same.

 

Thanks,

 

 

1 ACCEPTED SOLUTION

@kranthi2 

 

Sure.

Open your step 7 Set Field value.

In the Alarm start field write this javascript code.

javascript:gs.daysAgo(-10)

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

View solution in original post

5 REPLIES 5

Basheer
Mega Sage

Hi @kranthi2 

Write a server side script before the setvalues.

In that server script bring todays date

In the set values in the alarm start map it to the return value of server side script step.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Hi @Basheer 

Thanks for the response, kindly help me out with the script please. i am new to the ServiceNow.

 

If you can help me out that would be really helpful.

 

Thanks,

Shaqeel
Mega Sage

Hi @kranthi2 

 

Use javascript

javascript:gs.daysAgo(-7)

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

Hi @Shaqeel 

 

Sorry for the delay in my response, thanks for the response.

 

Please help me out on which ATF test steps should i need to write this script.

 

Thanks,