How to CC in a Email Notification dynamically

Community Alums
Not applicable

Hi 

I have created a Notification to send when a Business application is Retired .

Now I have to copy the manager of the application in the Notification for that I created a Email script as below :

Name: Notif_Name

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

         email.addAddress("cc",current.u_manager.email,current.u_manager.name);

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

and called the same in the Notification body as below:

${mail_script:Notif_Name}

 

Is that correct or should I put any Glide Record query in the email script to cc the manager? Kindly help with it.

 

Thanks and Regards,

Prakash Yadav

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi @PRAKASH YADAV,

please try below email script

 

Email Script:

 

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

    email.addAddress("cc", current.u_manager.email.toString(), current.u_manager.name.toString());

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

 

Hope you it will help you.

Please Mark Correct/helpful if applicable, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

5 REPLIES 5

kamadi lokeshra
Tera Contributor

Notification email script:

email.addAddress("cc",current.variables.u_manager.email.toString(),current.variables.u_manager.name.toString());

//u_manager is variable in catalog item/Record producer