- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 05:55 AM
Hi Everyone,
I want to Automatically add users and distribution list to watch list using Workflow.
In the workflow I'm using the run script and below is the script I got from Add multiple users to Watch List via Workflow
However, this script is not adding the users and distribution lists. I have made the required changes to the user sys_id and included required email address but still nothing working.
Any help from you guys would be great.
Thanks
Jagadish
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 05:59 AM
Hi Jagadish,
Please try below
var usersandemails = '';
usersandemails = 'a@example.com,b@test.com';
current.watch_list = usersandemails;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 05:59 AM
Hi Jagadish,
Please try below
var usersandemails = '';
usersandemails = 'a@example.com,b@test.com';
current.watch_list = usersandemails;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 04:13 AM
Hi Venkat,
Thanks for the script. It's working perfect now.
Regards
Jagadish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2021 03:12 AM
Hello Venkat,
I tried to follow your guidance and created the below business rule to send an notification to a email Distribution list.The notification is being sent to the groups,caller,onbelahf person but not the DL in watchlist.
Could you please check the code and help me out.
the IT_Ops_Communication@anc.com is a DL group and it is very active in outlook.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("incident");
gr.addQuery("caller_id", current.caller_id);
gr.addQuery("business_service", current.business_service);
gr.query();
if (gr.next()) {
var usersandemails = '';
usersandemails = 'IT_Ops_Communication@anc.com';
current.watch_list = usersandemails;
var currentList = current.watch_list;
if (currentList.indexOf(user_name) !== undefined) {
gs.addInfoMessage("User already present in the WatchList hence not added");
} else
if ((current.business_service.getDisplayValue() == "MES" || current.business_service.getDisplayValue() == "Mes ALE" || current.business_service.getDisplayValue() == "MES Global" || current.business_service.getDisplayValue() == "AES-EI ALE" || current.business_service.getDisplayValue() == "AES/EI Global")) {
gs.addInfoMessage("Adding users to the watchlist");
//for (var i = 0; i < user_name.length; i++) {
currentList += usersandemails + ',' + current.u_on_behalf_of;
//}
} else {
gs.addInfoMessage("check the services please");
}
}
})(current, previous);