- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2016 05:22 PM
Hi Colin,
No problem, and where are you located...
It should be easy enough to adapt to use a user reference field instead of the current user. It would vary depending on whether you are talking about Incidents (caller_id) or Requests (requested_for). The simplest would be to setup a BR on each table ([incident], [sc_request], etc.)... You could setup the BR on [task] instead, however you would have to check the task type to account for the differences in the user reference field names.
Using Incidents as an example, the only change needs to occur in which user to use when drilling down to a company ID. I've bolded the change in this script (for Requests, change this to current.requested_for.company.sys_id😞
Table: [incident]
When: Before (Insert)
//Get all company users who have opted-in to receive such notices
var addUsers = new GlideRecord('sys_user');
addUsers.addQuery('u_opt_in_notify=true^company=' + current.caller_id.company.sys_id);
addUsers.query();
//Build the watch list as a comma separated string of sys_ids
var watchList = "";
var sep = "";
while(addUsers.next()){
watchList += sep + addUsers.sys_id;
sep = ",";
}
//Populate the watch list on the current INC record
current.watch_list = watchList;
Good luck,
-Brian