Mail Script CC not getting added (Requested for & Assigned to Manager)

JerushaB
Tera Contributor

Hi ,

I am facing an issue with adding users to the CC field through a Mail Script in ServiceNow notifications.

I need to dynamically add the following users in CC:

  1. Requested For
  2. Assigned To → Manager

The notification triggers successfully and the email is sent only to assigned_to, but the CC recipients are not being added.

Mail Script Code Used
(function runMailScript(current, template, email, email_action, event) {

 

    gs.info('[Mail Script] Script execution started');

 

    // CC Requested For
    if (!gs.nil(current.requested_for) && !gs.nil(current.requested_for.email)) {
        email.addAddress(
            'cc',
            current.requested_for.email.toString(),
            current.requested_for.name.toString()
        );
    }

 

    // CC Assigned To → Manager
    if (!gs.nil(current.assigned_to) &&
        !gs.nil(current.assigned_to.manager) &&
        !gs.nil(current.assigned_to.manager.email)) {

 

        email.addAddress(
            'cc',
            current.assigned_to.manager.email.toString(),
            current.assigned_to.manager.name.toString()
        );
    }

 

})(current, template, email, email_action, event);
Screenshot 2026-04-14 130218.png
 
Is there a recommended or supported alternative approach to dynamically add CC users?

Any insights or guidance would be greatly appreciated.

Thanks in advance.

2 ACCEPTED SOLUTIONS

Rakesh_M
Kilo Sage

Hi @JerushaB ,

I have checked the mail script from my side and it is working fine.
Please ensure there are no spaces in the mail script name.

Could you please provide a screenshot of the email when it is sent?

 

View solution in original post

Hi @JerushaB ,
At the moment, the email is being CC'd to the Requested For user, but not to the manager of the Assigned To user.
Could you please confirm whether the Assigned To user has a manager configured?
If Assigned to has a manager, kindly also verify that the manager has a valid email address on their user record.

View solution in original post

7 REPLIES 7

Rakesh_M
Kilo Sage

Hi @JerushaB ,

I have checked the mail script from my side and it is working fine.
Please ensure there are no spaces in the mail script name.

Could you please provide a screenshot of the email when it is sent?

 

Hey ,
I tried again but the mail has only been sent to the assigned user and the admin(requested by) but the cc isnt sent to the manager.

 

For some reason im not able to upload the image but let me give you a clearer idea of the scenario.
I have built a catalog item and the logged in user is the Assigned to user(it should autopopulate) and the manager of the assigned to user has to be auto populated.
Now when I click on submit the email notification has to the assigned to user with the catalog item details and the cc to manager with the same information.
It's only being copied to the requested user and not to manager.
thanks in advance and please do help on what can be done.

Hi @JerushaB ,
At the moment, the email is being CC'd to the Requested For user, but not to the manager of the Assigned To user.
Could you please confirm whether the Assigned To user has a manager configured?
If Assigned to has a manager, kindly also verify that the manager has a valid email address on their user record.

J Siva
Kilo Patron

Hi @JerushaB 
Script looks good.

Also note that CC and BCC recipients are listed under the "Copied" field in the email log, not under the "Recipients" field.
JSiva_0-1776155259724.png

Regards,
Siva