- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 08:52 AM
Hello experts,
I am trying to send approval emails to approvers if they have not approved yet, this is the scheduled job:
*********************************************************************
remindApprovers();
function remindApprovers(){
//remind everyone, all the time?
var Task = false;
var appr = new GlideRecord('sysapproval_approver');
if (Task) {
appr.addQuery('state','requested');
//appr.addQuery('source_table','sc_req_item');
}
else{
//appr.addEncodedQuery('sysapproval.ref_sc_req_item.request.requested_forNSAMEASapprover^sys_updated_onRELATIVELT@hour@ago@48');
appr.addEncodedQuery('state=requested^sys_updated_onRELATIVELT@hour@ago@48');
//reminder for approvals requested and not updated in the last 48 hours
}
appr.query();
while (appr.next()){
gs.eventQueue("reminder.approval.2days", appr, gs.getUserID(), gs.getUserName());
gs.log('Re-requested approval of a task' + appr.sysapproval.number + " by " + appr.approver.name);
}
}
*****************************************************************
The issue here is that it is working but keeps sending emails after the first one when 48 hrs are due, it does not stop until the ticket gets cancelled:
I created 2 scheduled jobs, one at 7am and another one at 7pm so that it runs twice a day but as you can see, after the 48 hrs (first recors 11-07-2019), it keeps sending the notification every day, it does not stop.
The idea is that it sends just one notification after the 48 hrs, and that's it.
What am I doing wrong?
Thank you!
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:27 AM
HI,
If you dont want that then there is one other approach as below:
Second way:
https://community.servicenow.com/community?id=community_blog&sys_id=a98ce6e1dbd0dbc01dcaf3231f961927
Third:
Four:
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:23 AM
Hi,
You should have one checkbox on the approval table which will tell you that first notification is sent and hold the date time value when the notification was sent. Then in code you have compare that date with current date.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:27 AM
HI,
If you dont want that then there is one other approach as below:
Second way:
https://community.servicenow.com/community?id=community_blog&sys_id=a98ce6e1dbd0dbc01dcaf3231f961927
Third:
Four:
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:28 AM
Thank you will check them! appreciate your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 12:23 PM
Great! Glad i could help.
Thanks,
Ashutosh