How to Add CC Approvers in Notification Email for RITM Reminders in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 01:23 AM
Hi ServiceNow Community,
I have a requirement to trigger a notification reminders email to the requester and with all approvers in CC for a specific RITM (Request Item) on day 5 and day 7 . I have created an event in the event registry for the sc_req_item table with the event name approval_reminder.notification. I also created a notification using the sc_req_item table, and set the recipient to requested_for.
However, I am struggling to add the approvers in the CC field of the notification. Below is the script I am using in my Script Include:
var q = new QuestApprovalHelper();
var grApproval = new GlideRecord('sysapproval_approver');
grApproval.addQuery('state', 'requested');
grApproval.addQuery('sysapproval.sys_class_name', 'sc_req_item');
grApproval.addEncodedQuery("sys_created_on>=javascript:gs.dateGenerate('2025-05-24','00:00:00')");
grApproval.query();
var isprocessed = [];
var ccApprovers = [];
while (grApproval.next()) {
var daysSince = q.daysSince(grApproval); // counted using some functionality and it is working
var requestId = grApproval.getValue('sysapproval');
if (daysSince >= 😎 {
// cancelRequest()
} else if (daysSince === 7 || daysSince === 5) {
gs.print(grApproval.getDisplayValue('sysapproval'));
sendRequesterReminder(requestId);
}
}
function sendRequesterReminder(requestId) {
if (!isprocessed.includes(requestId)) {
var ccApprovers = [];
var grApproval = new GlideRecord('sysapproval_approver');
grApproval.addQuery('state', 'requested');
grApproval.addQuery('sysapproval.sys_class_name', 'sc_req_item');
grApproval.addQuery('sysapproval', requestId);
grApproval.query();
while (grApproval.next()) {
ccApprovers.push(grApproval.getValue('approver'));
}
isprocessed.push(requestId);
gs.eventQueue('approval_reminder.notification', requestId, '', ccApprovers.join(','));
}
}
I need guidance on how to properly add the approvers in the CC field of the notification script or someother. Any help or suggestions would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 01:38 AM - edited 06-05-2025 01:51 AM
for setting CC you need to use email script and then use this line
email.setAddress('CC', 'emailAddress', 'name');
You are already sending CC users in event parm2 so use this
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var ccUsers = event.parm2.toString();
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", "IN", ccUsers);
gr.query();
while (gr.next()) {
email.addAddress('cc', gr.getValue('email'), gr.getDisplayValue());
}
})(current, template, email, email_action, event);
you can include email script in your email body using this syntax
${mail_script:mailScriptName}
check this for further help
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 06:28 AM
Hi
can you help me to write the email script according to the below function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 08:28 PM
Sorry but I already answered your original question considering you are sending cc users in eventQueue
Did you try that?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 12:23 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader