Adding gmails to CC

vivek110
Tera Contributor

Hi all,
i have a requirement to add email address from two fields in the CC of the notification that will trigger once the status is closed complete.I have tried using Notification script but it is not working kindly help me on this.

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

        email.addAddress('cc', current.delivery_head_email_id);
        email.addAddress('cc',current.soh_email_id);
   
})(current, template, email, email_action, event);
 
Please correct my code to achieve this.here delivery_head_email_id and soh_email_id are the two backend name of the fields where we have email id's that id's we have to keep in the Notification CC. 


Regards,
Vivek

4 REPLIES 4

Chaitanya ILCR
Kilo Patron

Hi @vivek110 ,

the email script looks good it should work.
can you share the screen shot of the notification?

 

Regards,

Chaitanya

Vinuthna Ammana
Mega Guru

Please check Solved: How do I add a cc in an email notification?? Pleas... - ServiceNow Community
Add something like  email.addAddress('cc', current.delivery_head_email_id,current.delivery_head_name);

Regards,
Vinuthna

Runjay Patel
Giga Sage

Hi @vivek110 ,

 

I am assuming both fields are dictionary of the target table and not the catalog variables.

 

Make sure your email script is getting called from notification, check the syntax, it should be like "${mail_script:incident_closed_cc_list}".

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Pradeep Thipani
Mega Sage

Hi @vivek110 ,

 

Sample script you can try:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          email.addAddress("cc","pradeep@gmail.com","Pradeep");

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

 

 

Thanks,

Pradeep

 

 

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep