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 to send CC,BCC in email notifications

Gangadhar540-
Tera Contributor

how to send CC,BCC in email notifications

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Gangadhar540- 

 

You can write notification email script like this

 

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

// Add your code here

var user = new GlideRecord("Query your table");
user.addQuery("Apply filter");
user.query();
while(user.next()){
email.addAddress("bcc",user.getValue('email_address'),user.getValue('name'));

email.addAddress("cc",user.getValue('email_address'),user.getValue('name'))
}


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

add this mail script into your notification

 

https://www.servicenow.com/community/developer-forum/trying-to-add-cc-to-a-email-notification-throug...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

1 REPLY 1

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Gangadhar540- 

 

You can write notification email script like this

 

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

// Add your code here

var user = new GlideRecord("Query your table");
user.addQuery("Apply filter");
user.query();
while(user.next()){
email.addAddress("bcc",user.getValue('email_address'),user.getValue('name'));

email.addAddress("cc",user.getValue('email_address'),user.getValue('name'))
}


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

add this mail script into your notification

 

https://www.servicenow.com/community/developer-forum/trying-to-add-cc-to-a-email-notification-throug...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************