How to Delay Business Rule for some time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2021 04:50 AM
Hello All,
A Business Rule is there which will trigger based on a condition. But the script in the Business Rule should trigger after some delay of 1minute. When i am using gs.sleep() it is not working.
Can anyone suggest me how to delay the script to run for 1min after theBR triggers based on the condition.
Thanks & Regards,
S.Swaroop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 06:46 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
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
‎06-17-2021 05:23 AM
Hi,
Also why are you using current.update() in BR; it is not good practice.
Instead make this BR as before update
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
‎07-05-2021 10:40 AM
You can create an event scheduled after a certain amount of time
Here is a code snippet
var gdt = new GlideDateTime(gr.sys_created_on);
gdt.addDaysUTC(1);
gs.eventQueueScheduled('approval.reminder', gr, '', '', gdt);
You can then write a script to handle the event when it gets processed.
Vinod Kumar Kachineni
Community Rising Star 2022