How to add users from watch list to the CC of email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 03:18 AM
Hi all,
I have a requirement where i need to add all the watchlist users to the CC of email notification.
I have written the mail script but not getting the outcome.
Could someone help me on this.
Tried putting logs.
Log inside while loop is not coming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 03:36 AM
@Rutusha Hi! Use below-
current.watch_list +=email.copied;
or
current.watch_list = current.watch_list + ',' +email.copied;
Please mark it helpful if it helps.
Thanks,
Sonia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 03:45 AM
HI @SoniaShridhar13 - No luk still not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 03:48 AM
Hi @SoniaShridhar13,
That is the other way around, to add users in cc to the watchlist.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 03:46 AM - edited 08-28-2023 03:47 AM
Hi @Rutusha,
Use this script in your email script:
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());}}From: Example scripting for email notifications (servicenow.com)
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
