- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 11:25 AM
Because of the way my organization has chosen to escalate incidents to sysadmins and netadmins, I need to figure out how to automatically add users in the System Administrators and Network Administrators groups to the work notes list. I've got every other element of the escalation model configured except for this part. Currently the netadmins and sysadmins have to manually assign themselves to the work notes list. Otherwise they won't get updates when the work notes are updated by other members of IT (help desk, other admins, etc.). The problem is, a lot of times they forget to add themselves to the work notes list so I'd like to automate that function but I CANNOT seem to figure out how to do it. Any help would be greatly appreciated.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 12:26 PM
Okay, in that case, the modified script is
Step1: Create an BEFORE business rule and select advanced checkbox to true, insert and update to true
Filter condition : work notes | changes
Step 2: Enter the below script in the business rule script section area.
(function executeRule(current, previous /*null when async*/) {
var watchList = current.work_notes_list.getDisplayValue();
var caller = gs.getUserID();
var out = watchList.search(caller);
if(out == -1)
{
current.work_notes_list += ',' + caller;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 12:10 PM
I'm not well versed in scripting functions in servicenow but the above code looks to me like the entire group would be added? I just want to add the individual admin that contributed to the work notes. If I am incorrect in my assumption, I apologize.
Thanks,
Kevin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 12:12 PM
The script was based on the assumption that you want to add group members. So you mean that you want to add two individual users?
Is that correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 12:14 PM
No sir. I only want to add the individual who makes an entry into the work notes field of the incident. So anyone that enters work notes is automatically added to the work notes list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 12:26 PM
Okay, in that case, the modified script is
Step1: Create an BEFORE business rule and select advanced checkbox to true, insert and update to true
Filter condition : work notes | changes
Step 2: Enter the below script in the business rule script section area.
(function executeRule(current, previous /*null when async*/) {
var watchList = current.work_notes_list.getDisplayValue();
var caller = gs.getUserID();
var out = watchList.search(caller);
if(out == -1)
{
current.work_notes_list += ',' + caller;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 06:23 AM
Pradeep,
That Worked!! Thank you so much for the assistance, It's greatly appreciated.
-Kevin