- 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-19-2020 08:44 AM
For 2 days, we cannot build encoded query directly. you can try something like this.
var gdt = new GlideDateTime();
gdt.addDays(-2);
var gr = new GlideRecord("rm_story");
gr.addQuery("state=1"); //place value of UAT here
gr.addQuery("sys_updated_on","<",gdt);
gr.query();
while(gr.next())
{
gs.eventQueue('your_event_name',gr,gs.getUserName(),gs.getUserID());
}
Mark the comment as helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 12:14 AM
On hold reason = waiting information and Follow up = true mails are receiving every time interval but the problem is
for testing purpose , if I run scheduled job for 1 hour , when one INC0010077 is updated at 9:00 AM and another INC0010078 updated at 09:30 AM the scheduled job runs with both tickets sending notification at a 10:00 Am time, but second INC0010078 send notification at 10:30.not sending at correct time.
var gr = new GlideRecord("incident");
gr.addEncodedQuery("active=true^state=3^hold_reason=6^u_automatic_follow_up=true");
gr.query();
while(gr.next())
{
gs.eventQueue('Automatic follow up', gr, gr.getValue('user'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 12:17 AM
On hold reason = waiting information and Follow up = true mails are receiving every time interval but the problem is
for testing purpose , if I run scheduled job for 1 hour , when one INC0010077 is updated at 9:00 AM and another INC0010078 updated at 09:30 AM the scheduled job runs with both tickets sending notification at a 10:00 Am time, but second INC0010078 send notification at 10:30.not sending.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 03:39 AM
For last working 3 days, last working 5days and 7 days, how could we? write the condition?