Notification Script - add delay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 03:36 AM
Is it possible to add a notification script via advance view. The script will be include adding a delay in sending the notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 03:58 AM - edited ‎05-19-2025 03:59 AM
Hi @Therese,
If I understand you right you wish to add delay, so that notification triggers after a certain time.
There is Advanced condition to write the script. I see one OOB notifications which has something similar to your ask.
Notification is called "ConnectMessagePushNotification".
You could try something like that see if that works.
var liveProfileGR = new GlideRecord("live_profile");
liveProfileGR.addQuery("document", event.parm1);
liveProfileGR.query();
liveProfileGR.next()
var liveGroupMemberGR = new GlideRecord("live_group_member");
liveGroupMemberGR.addQuery("group", current.group);
liveGroupMemberGR.addQuery("member", liveProfileGR.getValue("sys_id"));
liveGroupMemberGR.query();
liveGroupMemberGR.next();
var messageTime = current.sys_created_on;
var last_viewed = liveGroupMemberGR.last_viewed;
answer = messageTime > last_viewed;
Let me know if that works!
Regards,
Vikas K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 04:09 AM
what's your actual business requirement here?
where you want to give delay?
From where and how are you triggering the notification?
If you are using gs.eventQueue() then you can use gs.eventQueueScheduled() and give delay
You can use after insert/update Business rule with script like this
var gdt = new GlideDateTime();
gdt.addSeconds(3600); // Add 1 hour
gs.eventQueueScheduled("myEventName", gr, 'recipientEmailAddress', '', gdt);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 04:21 AM
Im also thinking of using event and BR. Sorry Im a newbie, Can i confirm what is gr? and can i not add both param 1 and param 2?
gs.eventQueueScheduled("myEventName", gr, '', '', gdt);