How to delay the workflow without using a timer (timing)?

Mi4
Tera Expert

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...)

find_real_file.png

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,

1 ACCEPTED SOLUTION

Mi4
Tera Expert

Hi everyone,

Thank you for advice.

I solved the business rule 'async' by using 'gs.sleep'.

Thank you so much.

Regards,

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So before setting the approval you need to wait for particular seconds

you can use workflow timer activity

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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,

Gaurav Shirsat
Mega Sage

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.

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.

 

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,