Email Remainders for open cases - how to set it up?

Shubha2
Mega Guru

I need to set up an email remainder for 5 groups for  their respective Open cases. Any suggestions how to achieve this?

Email remainder should have (May be in ONE Email)
     List of all the Open Cases  at the 90 day mark
    
    List of all the open cases - at the 120th day mark
    
    List of all the open cases - at the 150th day mark
    
    List of all the open cases - at the 180th day mark 
    
The Managers should be receiving weekly these remainders. 
These email reminder for any cases not in “closed” or “delete” status
Starting from the created date to 90th day and so on
Need to set this up to 4 different groups (example, HR, Finance, InfoSec..etc)

I read many articles which are similar to this.  Looks like I need to set up an event registry, Notification, schedule job etc. 
But I still don't know how to do this. 
Since, I need to setup for 4 groups and list all the open cases for 4 scenarios, Not too sure, how to calculate this and
Achieve the same? Do I need to setup 5 schedule jobs for 5 groups?  Any help would be greatly appreciated. 


Thank you
Shubha
1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi ,

1. Create 4 events (example case.90.day, case.120.day )

2. Create 4 Scheduled jobs / Flow designer (trigger event from job/flow)

3. Create 4 notifications which will be called by events to send notifications

Sample Scheduled job script:

You can test this in background script

var createdDate = '';
var today = new GlideDateTime();
var today_date = today.getDate();
var gr = new GlideRecord('tablename');
gr.addActiveQuery();
gr.addQuery('state', '4');// open case
gr.query();
while (gr.next()) {
createdDate = new GlideDateTime(gr.getValue('sys_created_on')); // created field
createdDate = createdDate.getDate();
var dur = GlideDateTime.subtract(createdDate, today_date).getRoundedDayPart(); // subtract today date - created date
if (dur == 90) { // 90 days
gs.info("INC"+gr.number);

 gs.eventQueue("eventname", gr,"","" ));

}
}

 

Regards
Harish

View solution in original post

5 REPLIES 5

Harish KM
Kilo Patron
Kilo Patron

Hi ,

1. Create 4 events (example case.90.day, case.120.day )

2. Create 4 Scheduled jobs / Flow designer (trigger event from job/flow)

3. Create 4 notifications which will be called by events to send notifications

Sample Scheduled job script:

You can test this in background script

var createdDate = '';
var today = new GlideDateTime();
var today_date = today.getDate();
var gr = new GlideRecord('tablename');
gr.addActiveQuery();
gr.addQuery('state', '4');// open case
gr.query();
while (gr.next()) {
createdDate = new GlideDateTime(gr.getValue('sys_created_on')); // created field
createdDate = createdDate.getDate();
var dur = GlideDateTime.subtract(createdDate, today_date).getRoundedDayPart(); // subtract today date - created date
if (dur == 90) { // 90 days
gs.info("INC"+gr.number);

 gs.eventQueue("eventname", gr,"","" ));

}
}

 

Regards
Harish

Thank you so much Harish. This is very helpful. So, this would list all the incidents (say there are 11 of them) which are open at that time? How would I include the list in the email(Notification?)

Thanks again
Shubha

Hi use schedule job to fire the event and Notification on 90th ,120 days. Have 4 Notification email scripts with same scheduled job script to send the case details.

Follow the steps here

https://community.servicenow.com/community?id=community_question&sys_id=9f9173c9db1f6850da1999ead3961916

Regards
Harish

Thank you so much for your help. Really appreciated your time to answer my questions. It is working for me now. Thanks a lot!!

Shubha