Automatically add work notes contributors to the work notes list

klopez138
Kilo Explorer

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

1 ACCEPTED SOLUTION

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


Screen Shot 2017-06-02 at 12.25.13 PM.png


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);


View solution in original post

12 REPLIES 12

You are very welcome Kevin. Thanks for participating in the community!


So I've noticed now that as the work notes get updated back an forth between admins and the help desk, contributors' names are being added multiple times. Is there a way to modify the script to check if the name is already on the list so as not to create duplicate entries? find_real_file.png


Hi Kevin and Pradeep



I actually thought that that was what the if statement checked?!


- doesn't "if (out==-1)" check if the current user is in the worknotes list?



-Jesper