Email notification is not triggering to CC

Renu9
Tera Contributor

Hi All,

 

I am having a  requirement to send the notification to contact person and cc to the manager.

I have written an email script "cc_to_manager", 

 

(function runMailScript(current, template, email, email_action, event) {
    email.addAddress("cc", current.manager.email.toString(), current.manager.getDisplayValue());
})(current, template, email, email_action, event);
 
It is not sending the email to CC. 
I also tried below but didnt worked
    email.addAddress("cc", current.contact.manager.email.toString(), current.contact.manager.getDisplayValue());
 
email.addAddress("cc", current.variables.requested_for.manager.email.toString(), current.variables.requested_for.manager.getDisplayValue());
 
Calling in the notification like :${mail_script:cc_to_manager}
 
Please guide me here
7 REPLIES 7

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Just to verify: Did you test this with actual send emails or is this just previewing the record or something? For example when previewing etc, indeed this won't be visible. Though sending actual emails it should be possible to use cc and bcc in mail script.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

Yes , I have send actual email.

And the email script I created is not in the global scope. Will it be an issue for this?

What is the logic from where the manager email should come from? Can you describe this? As you mentioned several examples 😅 So on what is the notification triggered for example? A created RITM? Something else?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

The record gets created in the custom table. When the record state changes to pending or closed incomplete, I need to send an email to contact person and also in the cc it should go to manager of the contact field.