Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Scheduled Script execution

LJ_23
Tera Contributor

Hello everyone I am trying to create a scheduled job: 

A scheduled job should run and check the end date within the Forescout Pen Test table.

If the end date has passed, the job should set the records to Disposed.

 

this is my script: 

LJ_23_1-1764080634759.png

 

But the status is not updating to disposed?

LJ_23_0-1764080585623.png

 

10 REPLIES 10

soumyadeep10
Tera Contributor

Hi @LJ_23 , 
From what I can see, your u_end_date field is a date field while in the script while querying the field you have used the gs.nowDateTime() function. 
Can you replace it with gs.now() and check whether it works or not. 

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

No this did not work 

@LJ_23 can you please share the choice labels as well as their backend names for status field

LJ_23_0-1764090020554.pngLJ_23_1-1764090037009.pngLJ_23_2-1764090054634.pngLJ_23_3-1764090067405.pngLJ_23_4-1764090081188.pngLJ_23_5-1764090097747.png