- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 09:39 PM
Need to trigger reminder notifications on 5,6,7 days depending on the due date custom field when the state doesn't change from assigned to review on the custom table and it is not associated to task table
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 09:58 PM
Hi
Create a schedule job and select "Run as : Daily" and use the below.. change the field names/table names/event name as per your defined names..
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('state=-5');
gr.query();
while (gr.next()) {
var start = new GlideDateTime('current.u_start_date');
var now = new GlideDateTime();
var diff = GlideDateTime.subtract(start, now);
var days = diff.getRoundedDayPart();
if (days == 5) {
gs.eventQueue("event.one", gr);
}
if (days == 6) {
gs.eventQueue("event.two", gr);
}
if (days == 7) {
gs.eventQueue("evet.three", gr);
}
}
I hope it definitely helps you, if so please mark my answer as both helpful and correct

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 09:47 PM
Hi there,
You could create a Scheduled Flow for this. Which runs daily, queries for the records you are after, and creating a Notification.
Zero code involved.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 09:52 PM
Thank you for the solution,
Can you please tell me in more detail pls

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 10:02 PM
Basically start of with creating a Flow, set it's trigger to daily. Then add a Lookup Records, lookup the records you are after, etc.. For any records matching your criteria, add a Send Notification.
All zero code. Probably you will receive answers containing code, though first go-to nowadays: Flow Designer. Scripting something like this, is for people who are not moving forward.
Give it a go, and mention here if you are stuck on a certain step and need assistance.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 09:58 PM
Hi
Create a schedule job and select "Run as : Daily" and use the below.. change the field names/table names/event name as per your defined names..
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('state=-5');
gr.query();
while (gr.next()) {
var start = new GlideDateTime('current.u_start_date');
var now = new GlideDateTime();
var diff = GlideDateTime.subtract(start, now);
var days = diff.getRoundedDayPart();
if (days == 5) {
gs.eventQueue("event.one", gr);
}
if (days == 6) {
gs.eventQueue("event.two", gr);
}
if (days == 7) {
gs.eventQueue("evet.three", gr);
}
}
I hope it definitely helps you, if so please mark my answer as both helpful and correct