Urgent | Help me Write Business Rule. send a Email notification just after 2 hrs of INC creation.

Mayank_Mishra
Tera Contributor

I want to send a Email notification just after 2 hours of Incident creation time. Tried with Condition builder in "when to send " section of notification, also created Event and trying to create Business rule trigger this event just after 2  hours of incident creation.

kindly suggest possible way to achieve this requirement either with Email Notification or Triggered by Firing a Event.

Help write Business Rule to trigger event Just after 2 hrs of INC creation time.

 

2 REPLIES 2

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Easiest way to do is to use workflow and add timer activity, simple and straightforward.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0815356

Another alternative is to use flow like below

https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/conce...

Please hit like and mark my response as correct if that helps
Regards,
Musab

Tai Vu
Kilo Patron
Kilo Patron

Hi @Mayank_Mishra 

Let's use this API eventQueueScheduled.

1. Create an Event Registry.

Sample below.

Screenshot 2023-10-24 at 16.50.01.png

 

2. Create an After (Async) Insert Business Rule. 

Sample script:

(function executeRule(current, previous /*null when async*/ ) {

    var gdt = new GlideDateTime(current.sys_created_on);
    var seconds = 2 * 60 * 60; //2 hours convert to seconds
    gdt.addSeconds(seconds);
    gs.eventQueueScheduled("cl.incident.creation.notify", current, '', '', gdt);

})(current, previous);

 

3. Create a new Notification trigger by the Event above.

Screenshot 2023-10-24 at 16.52.14.png

 

Let me know if it works for you. 

 

Cheers,

Tai Vu