- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:11 AM
Hi,
I have a requirement to add a specific person to the Incident watch list when the "Caller" field is populated with certain users. Is this best done with a business rule or client script?
Also, how would you configure it?
Thanks in advance!
Todd
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:23 AM
From a performance perspective unless you need it client side as the user is filling out the incident form to populate it, it is best to run it server side via a business rule.
Is this a hard coded person or is this person an attribute of these certain callers?
Create an advanced business rule that runs before insert/update and set the appropriate conditions via condition builder, and then a script like the following should work. This code will work even if the watch list is already populated.
var userToAdd = "sys_id_of_the_user"; //This is the SysID of the user to add to the watch list
var watch_list = current.watch_list.toString().split(",");
if (watch_list.toString().indexOf(userToAdd) == -1) {
watch_list.push(userToAdd);
current.watch_list = watch_list.join(",").toString();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:15 AM
Hello Todd,
Create a BEFORE business rule, define filter conditions as per your req and the script will be
current.watch_list=current.watch_list+','+current.caller_id;
Reference:
Business Rules - ServiceNow Wiki
Business Rule to Add User to Watch List if Caller is VIP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:16 AM
I would have a before insert/update BR that says,
if(user in <certain users>){
current.watch_list += specific_person;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:18 AM
There is also some other good info (actually credited to the same 2 people who answered above) at this link. It may be helpful to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 07:23 AM
From a performance perspective unless you need it client side as the user is filling out the incident form to populate it, it is best to run it server side via a business rule.
Is this a hard coded person or is this person an attribute of these certain callers?
Create an advanced business rule that runs before insert/update and set the appropriate conditions via condition builder, and then a script like the following should work. This code will work even if the watch list is already populated.
var userToAdd = "sys_id_of_the_user"; //This is the SysID of the user to add to the watch list
var watch_list = current.watch_list.toString().split(",");
if (watch_list.toString().indexOf(userToAdd) == -1) {
watch_list.push(userToAdd);
current.watch_list = watch_list.join(",").toString();
}