- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 08:32 AM
We have one catalogue form in that catalogue with one "Specify end date of roles access" Date field, and an email notification should be sent to a specific group based on that date.
Please find the Catalogue form screen shot, This date is always a future date, and only on that date is an email notification sent to the group.
Please help me on this how to do this requirement.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022 06:32 AM
Hi @Sravani47,
Try this updated scripts and modified it accordingly.
var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', "sys_id_of catalog_item");
gr.query();
while (gr.next()) {
var temp = gr.variables.end_date_of_roles_access.toString();
if (new GlideDateTime(temp).getDate.getNumericValue() == new GlideDateTime(temp).getDate().getNumericValue()) {
// gs.info("RITM Number: "+ gr.number + new GlideDateTime(temp).getDate.getNumericValue() + " - " + new GlideDateTime(temp).getDate().getNumericValue())
gs.eventQueue('Request.RoleRevoke.Enddata', gr, gr.assigned_to.toString()); // fire this events
}
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 08:50 AM
Hi @Sravani47 ,
You can create event and fire that event from scheduled job when date matches.
refer thread :https://www.servicenow.com/community/developer-forum/send-a-notification-when-date-is-reached/m-p/17...
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 12:54 AM
Hi Gunjan,
Thanks for you reply, email notification is not triggered
Created one Notification and added event is fired.
Created on Scheduled job and added script.
Please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 01:04 AM
Hi @Sravani47
Your if condition may not be matching.
You can make Run as below in order to match the exact time.
For now instead of gs.nowDateTime() enter same time as that of end date there and click on execute now button and check.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 02:42 AM
Hi Gujan,
Updated changes and clicked on execute now, but not trigged email notification