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.

Delete old scheduled job

Shir Sharvit
Tera Contributor

Hey
I created a form called quality event and it has a calendar_date_time field called u_reminder_date_and_time.

ShirSharvit_0-1702896020797.png


I created a business role that opens as soon as a change is made in this field, and it causes the creation of a scheduled job that causes the deletion of the value in the field - u_reminder_date_and_time when the selected time arrives.

ShirSharvit_1-1702896061057.pngShirSharvit_2-1702896080303.png

 

The scheduled job created:

ShirSharvit_3-1702896189739.png

 


I need to make sure that if the user changes the time he choose in the u_reminder_date_and_time field, the old scheduled job will be deleted and only the new scheduled job with the new time choosen will remain
How can I do that?

 

 

Thank; Shir

1 REPLY 1

Saurabh Gupta
Kilo Patron

Hi @Shir Sharvit 

Here what you can do is, create a reference field on u_quality_event table, when there is no job present on this field create a new one else you can update the old job. In this way you need not to delete the old job again and again.

 

 


Thanks and Regards,

Saurabh Gupta