Adding timer in Business rule

Uchel
Tera Contributor

Hello behind the notification I need to put a timer before triggering the notification in Business rule.

What code can I use/add?

 

Uchel_0-1686214742391.png

 

7 REPLIES 7

Sohail Khilji
Kilo Patron
Kilo Patron

Dear @Uchel ,

 

using gs.sleep('5000'); 

 

This will hold the execution of code in milliseconds based on the value that you pass... but this can have an impact of slowness kindly evaluate the risk and proceed. Also, Instead of using gs.sleep() use events for triggering that BR, it's best practice. Here's an example of delay applied on business rule and trigger event:

var when = new GlideDateTime();

var delay = new GlideTime();

delay.setValue("00:00:05");

when.add(delay);

gs.eventQueueScheduled("event_name", current, "", "", when);

 

Why don't you use flow designer + events to achieve this instead of using business rule..

 

 

 

I hope it helps...

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

But Is it possible to add timer in Business rule before can trigger the email?

Hi @Sohail Khilji ,

I tried the code gs.sleep('120000'); in BR but why the email cannot trigger? I'm just waiting 2 mins but no email send.

This is the BR that no gs.sleep code:

Uchel_0-1686303448897.png

And this is the email trigger:

Uchel_1-1686303496656.png

 

Hello I tried that but it's happen again the Intermittent issue.

Do you have idea how to create Flow designer for this issue?

Here's the Email script and BR:

Uchel_0-1687956467402.png

 

Uchel_1-1687956496122.png

 

SLA:

Uchel_2-1687956662709.png

Uchel_3-1687956684174.png

 

Thank you.