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-13-2024 11:37 AM
Please help @swathisarang98
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:49 AM - edited 03-13-2024 11:50 AM
Hi @msekla ,
You can create a scheduled job and in that get the end date and before 7 days of end date you can trigger an event and once event is triggered based on that you can create a notification,
scheduled Job,
var gr = new GlideRecord('sc_req_item');
gr.query();
if (gr.next()) {
var startDate = new GlideDate();
var gdt = new GlideDateTime(gr.variables.<fieldname>); // here add the backend name of 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, '');
// }
}
Event:
Notification:
What it will contain you can add based on your requirement
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-13-2024 11:51 AM
Can't I configure the timer and notification in workflow? Wouldn't that be easier or would it not give the same result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:03 PM
@msekla i have never tried it in workflow you can give it a shot, if it doesn't work you can go ahead with scheduled job and event
Thanks
Swathi