- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 07:31 AM
I have been tasked with adding the 'requested_for' variable as a CC to the approval request notification. This notification uses email template 'change.itil.approve.role'.
I have created an email script 'cc_requested_for' with this code:
This has been added to the email template 'change.itil.approve.role' however the requested for is not being added to the email notification.
How do I fix this?
Thank you,
Rachel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 09:04 AM
do this if you are talking about requested_for variable and not field on RITM
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
if (current.source_table == 'sc_req_item') {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
email.addAddress("cc", gr.variables.requested_for.email.toString(), gr.variables.requested_for.name.toString());
}
}
})(current, template, email, email_action, event);
if you are talking about requested_for field on RITM then use this
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
if (current.source_table == 'sc_req_item') {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
email.addAddress("cc", gr.requested_for.email.toString(), gr.requested_for.name.toString());
}
}
})(current, template, email, email_action, event);
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
04-23-2025 07:59 AM - edited 04-23-2025 08:01 AM
You have to get the actual records, I believe. Your code should look more like this:
var gr = new GlideRecord('sc_req_item');
gr.get(current.getUniqueValue());
var user = new GlideRecord('sys_user');
user.get(gr.request.requested_for);
email.addAddress("cc", user.getValue('email').toString(), user.getValue('name').toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 09:01 AM
Thank you - this added the requested for to the email but in the 'to' line and not 'cc'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 09:08 AM
That's odd. Make sure the email.addAddress line says "cc" and the quotes didn't do something weird if you copied and pasted them. It specifically says cc, so it shouldn't have added it to the to list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 09:04 AM
do this if you are talking about requested_for variable and not field on RITM
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
if (current.source_table == 'sc_req_item') {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
email.addAddress("cc", gr.variables.requested_for.email.toString(), gr.variables.requested_for.name.toString());
}
}
})(current, template, email, email_action, event);
if you are talking about requested_for field on RITM then use this
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
if (current.source_table == 'sc_req_item') {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
email.addAddress("cc", gr.requested_for.email.toString(), gr.requested_for.name.toString());
}
}
})(current, template, email, email_action, event);
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