How to Notify Someone 1 Week Before End Date

msekla
Tera Contributor

Is there a way to send out an email notification to the "Requested By" person on the External Vendor Access request for like a week before the end date is due?  Just notifying that the access will be rescinded soon, giving the person a chance to change/extend the due date, if needed. A screenshot of the form I am talking about is attached.

32 REPLIES 32

@swathisarang98 Can you try and to do it in a workflow for me and show me all your settings because I can't seem to get mine to work properly

Hi @msekla ,

 

Please refer to following thread:

https://www.servicenow.com/community/developer-forum/is-it-possible-to-create-a-notification-7-days-...

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

@swathisarang98 For some reason the email is firing right away as soon as the RITM is created and not actually alerting me when there is exactly 7 days until my ticket recinds. For example, I put the end date for April 2nd to test it, and it still sent me this email td when that date is not until 14 days from now. Please fix it, this is my code currently and I followed all of your screenshots perfectly:

var gr = new GlideRecord('sc_req_item');
gr.query();
if (gr.next()) {
 
    var startDate = new GlideDate();
    var gdt = new GlideDateTime(gr.variables.end_date);
 
    var dateDiff = GlideDateTime.subtract(startDate, gdt);
    var roundedDate = dateDiff.getRoundedDayPart();
 
    if (roundedDate == 6) {
        gs.eventQueue('expiry.notification', gr, '', '');
    } 
 
// else if (roundedDate == 13) {
    //     gs.eventQueue('expiry.notification', gr, 14, '');
    // }
 
}

hi @msekla , could you please share me the screen shot of the end date variable in ritm and all other configuration you have created (like scheduled job, event and notificatin)

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

@swathisarang98 Where would I find the end date variable in RITM, the one I know I made in the backend is end_date