How to Automate Daily Notifications for Open Incidents Till the Previous Day in ServiceNow?

kusumgautam
Tera Contributor

On daily bases I want to send an notification to the manager of like what all incident open till the previous date.

 

Should I use a Scheduled Job, Workflow, or Notification to achieve this, and what would the best approach be for such a use case?

 

Thank you

1 ACCEPTED SOLUTION

Ravi Gaurav
Giga Sage
Giga Sage

Hi @kusumgautam 

There are multiple ways like :-
1. use flow designer --> choose trigger as scheduled job(run daily) --> add action send notification --> choose your notification with appropriate filter.
2. Use Schedule job script to trigger the Notification by Gliding to the table(incident) and Achieve it .
3. In workflow also you can use run script to glide to the table and fetch data and triiger notificvation using gs.eventQueue()

sample Script :-

(function executeScheduledJob() {
var x= new GlideRecord('incident');
x.addQuery('state', '!=', '7'); // Exclude closed incidents
x.addQuery('opened_at', '<', gs.daysAgoStart(1)); // Opened before yesterday
x.query();

var incidentList = [];
while (x.next()) {
incidentList.push(x.number + " - " + x.short_description);
}

if (incidentList.length > 0) {
gs.eventQueue("custom.incident.notification", null, "manager@example.com", incidentList.join("\n"));
}
})();


--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @kusumgautam 

 

This will be helpful solution

https://www.servicenow.com/community/itsm-forum/scheduled-reports-to-send-to-assignment-group-manage...

 

https://www.servicenow.com/community/platform-analytics-articles/scheduling-a-report-for-dynamic-rec...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ravi Gaurav
Giga Sage
Giga Sage

Hi @kusumgautam 

There are multiple ways like :-
1. use flow designer --> choose trigger as scheduled job(run daily) --> add action send notification --> choose your notification with appropriate filter.
2. Use Schedule job script to trigger the Notification by Gliding to the table(incident) and Achieve it .
3. In workflow also you can use run script to glide to the table and fetch data and triiger notificvation using gs.eventQueue()

sample Script :-

(function executeScheduledJob() {
var x= new GlideRecord('incident');
x.addQuery('state', '!=', '7'); // Exclude closed incidents
x.addQuery('opened_at', '<', gs.daysAgoStart(1)); // Opened before yesterday
x.query();

var incidentList = [];
while (x.next()) {
incidentList.push(x.number + " - " + x.short_description);
}

if (incidentList.length > 0) {
gs.eventQueue("custom.incident.notification", null, "manager@example.com", incidentList.join("\n"));
}
})();


--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/