How to Notify Someone 1 Week Before End Date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:35 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 06:53 AM
@msekla , it will be available in RITM Variables it would look something like below,
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 07:09 AM
@swathisarang98 Here are all of the screenshots you asked for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 08:22 AM - edited 03-19-2024 08:25 AM
Hi @msekla ,
I have updated the schedule job to your requirement , it working correctly like including today it will check for next 6 days which is 7 days and will trigger notification,
and the addEncodedQuery will check only for your catalog item and it will check state is not closed (if required update the query )
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery('cat_item=90527e0393ecc6504487bd6cebba1078^stateNOT IN3,4,7'); // here add your catalog item name
gr.query();
while(gr.next()) { // change if to while
var startDate = new GlideDate();
var endDate = gr.variables.end_date;
var gdt = new GlideDateTime(endDate);
//gs.info('Line number 6 ' + gdt);
var dateDiff = GlideDateTime.subtract(startDate, gdt);
var roundedDate = dateDiff.getRoundedDayPart();
//gs.info(' line number 12 ' + roundedDate);
if (roundedDate == 6) {
gs.eventQueue('expiry.notification', gr, '', '');
}
}
and in your notification please add the "Requested for" for who will receive, which is missing
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 08:27 AM
@swathisarang98 Where would I add the requested for? And what's my catalog item name, do you mean the name of the form itself in the catalog which is External Vendor Access Request? Also, please remove any logging in the code like gs.info.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 08:35 AM
@msekla , in notification please add below,
yes the form sys_id you have to add otherwise it will run for all the ritm,
what you can do is go to sc_req_item.LIST in the filter add the below ,
on the bread crumbs right click and copy query ,
and paste it in gr.addEncodedQuery('here');
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang