With business rules Is it possible to delay the execution of the script by about 30 seconds?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2020 06:35 PM
With business rules Is it possible to delay the execution of the script by about 30 seconds?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2020 12:01 AM
Would you like to see if it's been 30 seconds?
I tried to run it, but in less than 30 seconds
I think the business rules are working soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2020 12:40 AM
Hi,
even if BR runs the event would be triggered immediately but it would be processed only after the time you have given i.e. 30 seconds in above case
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2020 08:59 PM
Hi SS
try using the gs.sleep(<seconds>);
or you can perform this by your own code also.
function delayExecute(time){
var delay1 = new GlideDateTime().getNumericValue();
var delay2 = new GlideDateTime().getNumericValue();
var difference = delay2 - delay1;
while(difference < time){
delay2 = new GlideDateTime().getNumericValue();
difference = delay2 - delay1;
}
},
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2020 09:09 PM
thank you
If I want to delay 30s,
gs.sleep(30); light?
after 30s,BR is restard job?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2020 09:22 PM
This sounds like a perfect use case for Flow, which runs Asynchronously (usually about 30 seconds after the trigger).
You can wait in the Flow or just rely on the asynchronous nature of the flow.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022