- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2014 10:18 AM
Can someone explain how I can set-up approval reminders to automatically be sent out daily? I am mostly interested in reminders for requests in the Service Catalog, but if it cannot be scoped to that, then any approval reminders will do? I can't believe this isn't an OOB scheduled job in ServiceNow...
Thank you,
Shane
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2014 09:08 PM
Hi Shane,
Since you have written the email notification in the sysapproval table, better you query sysapproval itself in the scheduled job. Please check the code below given by Bhavesh, its checking if the approval is for catalog request and whether the request is still in requested state. Please make sure you change the event name in the below code to the one you already have, it will look like this:-
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested');
gr.addQuery('sysapproval.sys_class_name','sc_request');
gr.query();
while (gr.next()) {
gs.eventQueue("catalog_task_approval_reminder",gr, gs.getUserID(), gs.userName());
}
In the email notification,for Who will receive, make Users/Groups in fields as 'Approver', it should work fine. Also make sure that you check the 'Send to event creator', its just for testing you can deactivate later.
Thanks & Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2014 05:29 AM
This works! I actually changed the query because I want to query on sc_req_item the more I thought about it and it works just fine. Much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 03:13 AM
How to apply filter/ write script to trigger event for a particular catalog item approval reminder ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2014 07:53 PM
Try this code in your job:
var app = new GlideRecord('sysapproval_approver');
app.addQuery('state', 'requested');
app.addQuery('sysapproval.sys_class_name','sc_request');
app.query();
while (app.next()) {
gs.eventQueue("sc_request_reminder",app, gs.getUserID(), gs.userName());
}
Regards,
Bhavesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2014 05:28 AM
Thank you for the code Bhavesh! This works supplemented with the event generation and e-mail notification that Hari helped me with earlier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2014 09:41 PM
Hi Shane,
Add this script to Scheduled Script Execution:-
This will send 3 day old pending Approval reminders.
You can configure this for any duration you like.
remindApprovers();
function remindApprovers()
{
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery('state=requested^sysapproval.active=true^sysapproval.sys_class_name=sc_req_item^sys_updated_onRELATIVELE@hour@ago@72^sys_created_onRELATIVEGE@hour@ago@96');
appr.query();
var last_approver;
while (appr.next())
{
if(last_approver != appr.approver.toString())
{
gs.eventQueue("approval.reminder.req", appr, gs.getUserID(), gs.getUserName());
}
last_approver = appr.approver.toString();
}
}
Thanks,
Subhajit