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 

3 REPLIES 3

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.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Mayu
Tera Guru
Tera Guru

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

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul
In less than 3 minutes, master the gs.eventQueueScheduled function, and trigger logic in the FUTURE! ▼▼▼ Expand for loads of helpful links ▼▼▼ PLEASE TAKE MY CONTENT SURVEY! https://www.surveymonkey.com/r/MBDT2QN My mailing list has my most exclusive long form content. Find out what over 300 of ...