Send notification 14 days before the expiry date (variable on record producer)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 09:47 AM
i want to send notification 14 days before the expiry date.Expiry date is the variable(type -Date) on record producer and it is a scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 10:39 AM
Hi Akash,
You can right a Scheduled Job which will run once a days.
In this Scheduled Job, write script to check that current Date is 14 days before Expiry Date. If yes, trigger new event using gs.eventQueue function and trigger email notification as per requirement.
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2022 12:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2022 02:36 AM
Hello Akash,
I dont think so it is necessary to add the record producer query in thr GLideRecord try removing it.
As record producer is used just to create a record and once the record is created you can directly access the variables from the record created.
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2022 02:11 AM
Hello Akash,
Please check once with below script:
(function () {
var expiryDateGDT = new GlideDateTime();
expiryDateGDT.addDays(14);
var expiryDate = expiryDateGDT.getDate();
var query = "task.variables.expiry_dateON" + expiryDate +"@javascript:gs.dateGenerate('" + expiryDate + "','start')@javascript:gs.dateGenerate('" + expiryDate + "','end')";
var incidentGR = new GlideRecord("Your Table Name");
incidentGR.addActiveQuery();
incidentGR.addEncodedQuery(query);
while (incidentGR.next()) {
gs.eventQueue("Your EVENT name", incidentGR, "Your Recepient", "");
}
})();
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
Please mark my response as helpful/correct, if it answer your question.
Thanks