- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2014 10:05 AM
Hi,
I have a requirement to send email in BCC. I have business rule which query user table and fetch all email ID's and saved it as a comma separate text. As of now It's working fine but all email going on To.
I want to send all email in BCC instead of To. I can't use email.addAddress("bcc", "john.secret@example.com","John Roberts"); as this will send email to only one. I have more than 1000+ users who is receiving email, in this case 1000+ emails will be triggered.
Do we have any function in SN which sends email in BCC with comma separated values.
Regards,
ND
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2014 11:22 AM
Hi ND,
You can make use of while loop, suppose if you want to add all users in incident watch list to bcc,
you can use the below code in your notification.
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 bcc list
email.addAddress("bcc", user.email, user.getDisplayValue());
}
Hope this helps.
Thanks,
Prasanna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2014 11:22 AM
Hi ND,
You can make use of while loop, suppose if you want to add all users in incident watch list to bcc,
you can use the below code in your notification.
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 bcc list
email.addAddress("bcc", user.email, user.getDisplayValue());
}
Hope this helps.
Thanks,
Prasanna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2014 11:24 AM
Thanks for reply.
I just did same thing.
Regards,
ND
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 05:45 AM
how do you do this for any notification? seems like above is related to watch list, but i'd want it just for any/all recipients for certain notifications.