How to delay a notification for 10 minutes before it triggers.

VIKAS MISHRA
Tera Contributor

As per the requirement i have created one new notification and that notification should trigger everytime when a new incident is inserted/created but it should trigger after 10 minutes of incident creation.

notification should triggers to assigned to user only.

Please sugest 

4 REPLIES 4

Basheer
Mega Sage

Hi @VIKAS MISHRA ,

You can write a BR in which you can trigger an event.

Before triggering an event write gs.sleep(addseconds);

Let me know if you need more help on this.

 

Not applicable

You can write a BR in which you can trigger an event.

Before triggering an event write

 

var d = new GlideDateTime(); d.addSeconds(600);

gs.eventQueue("notification  name");

Please mark helpful or correct.

 

Paul Curwen
Giga Sage

There is a better way than those suggested so far. Not many people seem to know this so read on to find out...

 

Most developers are familiar with using:

 

eventQueue

 

for putting an event in the Event Queue, from which for example your Notification can can triggered when the event is created, or say a Script Action is ran when the event is created. Well eventQueue has a close cousin and his name is : 

 

eventQueueScheduled

 

This enables you to pass an extra parameter 'expiration' which in my opinion is horribly named by ServiceNow and I prefer to think of it as 'process on' as you send any date/time in the future when you want to event to be processed!!! Yep good isn't it. No messing around with the dreaded gs.sleep for example šŸ™‚

 

It is documented here: 

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/no-namespace/c_GlideSystemScope...

 

Watch this for a very detailed example of how it's done: https://youtu.be/u38C-qNZcTQ

 

If this proves helpful please mark as Helpful/Correct

Johannes
Mega Sage