- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:08 PM
Hi Team ,
I have a notification which i have created on incident table which is currently sending to assignment group , however i need this notification to be send as CC to incident caller as well for that i am trying the below email script however its not sending the email to CC that is caller of the incident.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var inc = new GlideRecord('incident');
if (inc.get(current.incident))
{ // Assuming 'incident' is the reference field on the current record
// Retrieve caller information
var callerEmail = inc.caller_id.email.toString();
var callerName = inc.caller_id.name.toString();
// Add the caller's email as CC recipient
email.addAddress("cc", callerEmail, callerName);
// Add your code here
}})(current, template, email, email_action, event);
can anyone please help me here .
with screenshots .
Thanks in advance .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:25 PM
Hi @nameisnani
Can you try below script :
var userData = new GlideRecord("incident");
userData.addQuery("sys_id",current.sys_id);
userData.query();
if(userData.next()){
var callerEmail = userData.caller_id.email
var callerName = userData.caller_id.name
email.addAddress("cc",callerEmail,callerName);
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:25 PM
Hi @nameisnani
Can you try below script :
var userData = new GlideRecord("incident");
userData.addQuery("sys_id",current.sys_id);
userData.query();
if(userData.next()){
var callerEmail = userData.caller_id.email
var callerName = userData.caller_id.name
email.addAddress("cc",callerEmail,callerName);
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:28 PM
Hello @nameisnani ,
var callerEmail = inc.caller_id.email;
var callerName = inc.caller_id.getDisplayValue();
// Add the caller's email as CC recipient
email.addAddress("cc", callerEmail, callerName);
Kindly mark correct and helpful if applicable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 10:35 PM - edited 09-19-2023 10:36 PM
Hi @nameisnani
Please use the below code it is working, i have tested in my PDI.
var inc = new GlideRecord('incident');
if (inc.get(current.number))
{ // Assuming 'incident' is the reference field on the current record
// Retrieve caller information
var callerEmail = inc.caller_id.email.toString();
var callerName = inc.caller_id.name.toString();
gs.info('Incident Caller '+callerName+'. Incident Email ' +callerEmail );
// Add the caller's email as CC recipient
email.addAddress("cc", callerEmail, callerName);
}
Screenshot:
Mark the comment as a correct answer and also helpful if this has helped to solve the problem
Krishna Sharma