Wait condition in Scheduled Jobs

venkatkk
Tera Contributor

I have a Scheduled Jobs which running daily for Request (100+) records and assign it to specific group.

Is there any way to set interval say 10 seconds to between each and every records.

Reason we thought is that Scheduled Jobs runs for 100 records and assigning it to the group with in milliseconds , there is an workflow running for these records when it is assigned to the group, In this short interval not all records are taking the workflow and successful some are Out Of Scope because of the very short inteval of workflow processing.

Any help how to set wait for 10 seconds in the Scheduled Jobs script?

1 REPLY 1

mihaimanolescu
ServiceNow Employee
ServiceNow Employee

Hello,



there is a gs.sleep function however do not use this as the job will take a long time to complete and will hang the worker. Instead i would recommend to have this job run every 10 seconds / 1 min / 10 minutes or what ever your preference and set the GlideRecord setLimit to 1 so it will only process one record for each occurrence. More info here: GlideRecord - Scoped