- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 08:33 PM
Hi,
My requirement is that like setting a timer in a workflow, I would like to use business rules and other features to set a delay before the workflow's approval record occurs.
(The real requirement is that I want to copy a file to an approval record, I've confirmed that this can be done by setting a timer before the approval record is created, but it's a non I think it is efficient...)
I know 'gs.sleep' is available in global scope, but I don't know where (timing) to implement it.
Example:
At which table and at what timing should the gs.sleep be executed?
Such Does anyone know the conditions and implementation method?
Regards,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 09:41 PM
Hi everyone,
Thank you for advice.
I solved the business rule 'async' by using 'gs.sleep'.
Thank you so much.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 09:07 PM
Hi,
So before setting the approval you need to wait for particular seconds
you can use workflow timer activity
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
‎04-13-2020 09:11 PM
Hi,
Thank you for advice.
I don't think it is realistic to implement it for each workflow.
So I want to know how to set the timer before creating all approval records.
Also, if you implement without using a timer in the workflow, it would be nice if you also know at what timing the process should be described.
Regard,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 09:22 PM
Hi Mi
There might not be a better way to do it, but at the beginning of the workflow you could add a "Wait for condition" with a script that compares the termination and returns true if it is past, and false if has not. Then you can put in a "Timer" on the false track that waits for a while and then circles back around to the "Wait for condition" statement.
You could just use the "Timer" and use a script to set it to wait the number of seconds between the current time and when it is supposed to proceed, but that wouldn't allow for updates to the time later. For example if they said terminate the employee on this date and then later said, never mind, we need it done right away.
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 10:59 PM
Hi,
Thank you for advice.
After all, is there no choice but to delay in the workflow?
Is the method using gs.sleep or event and script action unrealistic?
Regards,
Also note that a 30 second delay will be 30 seconds + processing time,
as the delay is via a sys_event which will be batch processed once the time is reached
and may also be subject to additional delay if the node that picks up the event for processing is busy.