- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 08:54 PM
In my req
I want to send notifications to the owner of the story, if state changes to UAT and testing will not happen upto 2 days.
So need to set reminder for the story owner after 48 hours , still story testing pending
I created event and business rule but its not wrking
Can anyone help me out on this
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 01:46 AM
Hi Nag,
Instead of BR, try scheduled job. Because with BR, once the event is scheduled, it will trigger event irrespective of update happened later or not. Since you want to send notif only if there is no update in 2 days after state changes to UAT, it is better to try with scheduled script.
var gr = new GlideRecord("rm_story");
gr.addEncodedQuery("sys_updated_on<javascript:gs.beginningOfYesterday()^state=1"); //place value of UAT here
gr.query();
while(gr.next())
{
gs.eventQueue('your_event_name',gr,gs.getUserName(),gs.getUserID());
}
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 09:02 PM
Hi,
So when state changes to UAT you can trigger using eventScheduled()
BR: After update State changes to UAT
Script below:
Ensure you use proper owner field
this will send the event exact 48hours after state changes to UAT
var newDateTime = new GlideDateTime(date);
newDateTime.addDaysUTC(2);
gs.eventQueueScheduled("event_name", current, current.owner, current.owner.getDisplayValue(), newDateTime);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
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-2020 12:28 AM
Hi Ankur
Im trying same code, can you help how to make time for 5 mins for testing purpose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:37 AM
Hi,
for testing purpose you can give 5mins as below
addSeconds(300)
var newDateTime = new GlideDateTime(date);
newDateTime.addSeconds(300);
gs.eventQueueScheduled("event_name", current, current.owner, current.owner.getDisplayValue(), newDateTime);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
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-2020 12:45 AM
same code im trying ankur, but email is not triggering