Need to trigger approval notifications daily for select catalog items
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
PFB my scheduled script and Notification Body. Please help me in achieving the above. Note that I need to include both the RITM and the approval link in the email.
(function() {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('approval', 'requested');
ritm.addQuery('cat_item', 'IN',
'838a577b2b5772d43609f1bfe291bf05,c6e029a5932c83145a2fb5ad1dba10a8,bb02e6252be44bd03609f1bfe291bf8a,b1d60ff52ba80fd03609f1bfe291bf06'
);
ritm.addActiveQuery();
ritm.query();
while (ritm.next()) {
notifyApprovers(ritm);
}
function notifyApprovers(ritm) {
var appr = new GlideRecord('sysapproval_approver');
appr.addQuery('sysapproval', ritm.sys_id);
appr.addQuery('state', 'requested');
appr.query();
while (appr.next()) {
// Fire an event OR send email directly
gs.eventQueue(
'ritm.approval.reminder',
ritm,
appr.approver,
appr.sys_id.toString()
);
}
}
})();
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader