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.

email notification

kavitha18
Tera Contributor

I want to send an email notification 'Assigned To field manager' in CC 

For ex: Assigned to : My self 
cc: My manager email

I will really appreciate your responses.

Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@kavitha18 

you can't set the manager as CC directly using Email Notification

you need to use Email script for this and then include that in your notification body like this

1) Create a New Notification Email Script:

AnkurBawiskar_0-1764586008170.png

 

2) Mail script
Name: Mail Script Name

Script: your script

3) Now call this Notification Email script in your Notification as shown below using the syntax:

${mail_script:Mail Script Name}

 

AnkurBawiskar_1-1764586008175.png

 

Email script as this

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

    // Add your code here
    email.addAddress("cc", current.assigned_to.manager.email.toString(), current.assigned_to.manager.name.toString());

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

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Dhanraj B
Tera Expert

Hi @kavitha18 ,

 

You can use email script to add "Assigned to" field's manager in CC.

email.addAddress("cc","email_address","recipient_name");

 

If this helped you in anyway, please hit thumps up or accept this as solution if it resolved your query.

 

-Dhanraj.

Ankur Bawiskar
Tera Patron
Tera Patron

@kavitha18 

you can't set the manager as CC directly using Email Notification

you need to use Email script for this and then include that in your notification body like this

1) Create a New Notification Email Script:

AnkurBawiskar_0-1764586008170.png

 

2) Mail script
Name: Mail Script Name

Script: your script

3) Now call this Notification Email script in your Notification as shown below using the syntax:

${mail_script:Mail Script Name}

 

AnkurBawiskar_1-1764586008175.png

 

Email script as this

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

    // Add your code here
    email.addAddress("cc", current.assigned_to.manager.email.toString(), current.assigned_to.manager.name.toString());

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

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader