Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

25 REPLIES 25

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