Monthly email reminders for incidents over 30 days old

John H1
Tera Guru

I have a request to generate emails to be sent to the Assigned To for incidents that are more than 30 days old.

We would like a single email for each Assigned To user *versus several emails for each incident)

Ideally, we would like to run this as a scheduled job if possible.

3 REPLIES 3

Amit Pandey
Kilo Sage

Hi @John H1 

 

First of all, you need to create an event in Event Registry table and a Notification with When as Event is triggered. Then you can use the following schedule job script to send the notification-

 

sendNotification();

function sendNotification() {
    var inc = new GlideRecord("incident");
    inc.addEncodedQuery('active=true^assigned_toISNOTEMPTY^sys_created_on<=javascript&colon;gs.beginningOfLast30Days()');
    inc.setLimit(100);
   inc.query();
    while (inc.next()) {
        gs.eventQueue('incident.30days', inc, inc.assigned_to.email.toString(), inc.assigned_to.user_name.toString()); // incident.30days is the name of event.
    }
}

 

Please mark my answer helpful and correct.

 

Regards,

Amit

Brian Lancaster
Tera Sage

How often will you be sending this notification?

John H1
Tera Guru

Sorry for the delay getting back to you, (I pulled into another project).

I would like to run this report weekly.

I've never worked with creating an Event Registry, any assistance setting this up would be greatly appreciated.