How to add CC or BCC in email notification?

User150433
Tera Guru

How to add CC or BCC while using email notifications and templates?
There is no option to set CC or BCC field in that.

12 REPLIES 12

is it possible to implement the cc functionality in any other way?


HI John,



Are we suppose to add these lines in the email scripts in the email notification body?



Thanks,


Fathah
Giga Contributor

for cc and bcc, I gave code like this.

if (!current.watch_list.nil()) {
//get watch list addresses and add to cc
var watcherIds = current.watch_list.split(",");

//get user records
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", watcherIds);
user.addQuery("notification", 2); //email
user.addQuery("email", "!=", "");
user.query();

while (user.next()) {
//add to cc list
email.addAddress("cc", user.email, user.getDisplayValue());
email.addAddress("bcc", user.email, user.getDisplayValue());
}
}


email is fetching but bcc is showing in the activity log, cc is not showing in the activity log.
Any other way to solve this problem.
Can anyone please help me out from this?


Abdul, are you referring to the activity log on the task? It should be the opposite, the recipient and cc should show in the task activity viewer on the task (assuming email is checked in activity formatter filter). The bcc should not display.
Are the emails being sent to all addresses? If not you could add some debug log statements to your script to see if the query is getting the correct values.
something like:
gs.log("Emailing " + user.email + ":" + user.getDisplayValue());
in the while loop.

I'm wondering if we are suppressing one of the bcc or cc in your test case since you are sending adding the same email to both.


John,
ya tried, email is getting and i tried in Background script also full script is working.