How do I add a cc in an email notification?? Please help!

paradise623
Giga Expert

Hi All,

Please help I am looking to add a cc box in an email notification but I can't seem to locate how to do this. I see a bunch of things in the community but it appears that it all involves scripting. Is there anyway around this?

Thanks!

1 ACCEPTED SOLUTION

That is definitely doable, too. So, rather than putting in an address and name manually, you can reference a field/variable from the table.



So, you could do something like this to send a CC to the manager of the current assignment group on an incident email:



email.addAddress("cc", current.assignment_group.manager.email, current.assignment_group.manager.name);


View solution in original post

24 REPLIES 24

Hi,


I have created the same scenario as you have described with same name also in the below instance


ServiceNow .


User Name:admin


Password:admin



Please login to the instance and Order a "Acrobat" catalog item which is under Software category.


Then Please check email logs and notification created.


Please compare this with your instance and correct accordingly.



Please mark it as Helpful/Correct according to its impact .



Thanks,


Mihir


Hi @Mihir Mohanta,

I have almost same scenario:

I have 1 approval reminder email notification (sysapproval_approver) table.

We want to trigger email to "requested_for" in CC.

How can we acheive this.

I have tried to write mail script also but not sure how we can pass address and name in this case. Because notification is on sysapproval_approver table and we want to  access requested_for field for RITM.

 

Kindly help me out.

 

Many Thanks,

Anupam

 

 

The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Scripting for Email Notifications




Visit http://docs.servicenow.com for the latest product documentation


Thank you for explaining, i learnt a new thing today. Tested and it works.

Stacy1
Mega Guru

I have tried this ten different ways and my CC always shows up undefined.   My log statements are showing the user name and email correctly.   Any thoughts?



(function runMailScript(current, template, email, email_action, event) {




var pro = current.u_provisioner;


gs.log("Provisioner is " + pro);


var proinfo = new GlideRecord('sys_user');


proinfo.addQuery('sys_id', pro);


proinfo.addQuery("notification", 2);


proinfo.addQuery("email", "!=", "");


proinfo.query();


gs.log("Provisioner email is " + pro.email + " name is " + pro.getDisplayValue());



gs.log("pro name " + current.provisioner.name + " email " + current.provisioner.email);


email.setReplyTo(current.u_provisioner.name+' <'+current.u_provisioner.email+'>');


email.setFrom(current.u_provisioner.name+' <'+current.u_provisioner.email+'>');


email.addAddress("cc", proinfo.getDisplayValue(), proinfo.email);






})(current, template, email, email_action, event);



thank you,


Stacy