How to send one email daily regaurdless of how many incidents/requests a user generates?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 08:46 AM
I have a scoped application that pulls in incidents from an outside platform. User may get one incident or multiple incidents each day. The incidents show up on a Service Portal page that allows each user to view only their assigned incidents. I don't want users getting spammed with a notification for each incident. I just want to send an email once a day that alerts the user they have new incidents to review and points them to the Service Portal page. All the information I find points to doing a notification per a record. I want to filter users who have an assigned incidents today and then send one email only.
I am open to any option that will allow me to do this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 10:01 AM
Thank you for the clarification!
That's actually much less complex that I had originally understood. To build on both what Cameron and I said; you definitely could build a scheduled job that would run a GlideAggregate against the incident table with conditions to only look for incidents created 'today' and aggregate by user.
//Scheduled Job to trigger event/notification for each assigned to user with an incident today
var incAgg = new GlideAggregate('incident');
incAgg.addAggregate('COUNT', 'assigned_to');
incAgg.orderBy('assigned_to');
incAgg.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
incAgg.query();
while (incAgg.next()){
var incCount = incAgg.getAggregate('COUNT', 'assigned_to');
gs.eventQueue('incident_rollup', incAgg, incAgg.assigned_to);
}
With the scheduled job above, you can trigger your notification to the assigned_to user using event.parm1 and you could also use a mail script to create the dynamic Service Portal URL by embedding the event.parm1 sys_id into the URL.
I hope that helps you get closer to solving your business requirement!
Thanks,
Michael