The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Add two user to Watch List

amacqueen
Mega Guru

On our change request I want to permanently add two of our process users to the watch list. So for all change requests these two users should be on the watch list.

I've had a look around the community and can't find what I want.

Any suggestions?

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

Instead of scripting this, why don't you just add them to the notifications sent out to the watch list?



Capture.PNG


View solution in original post

7 REPLIES 7

simonw
Tera Expert

Hi Angus,



You can just add the users as defaults in the dictionary for your watch list, just separate them by a comma.   I'd suggest using the sys_id's of the users.



You can also script this so that every change of a change confirms the users are in the watch list with an onBefore business rule



checkWatchList(sysIDOfUser1);



checkWatchList(sysIDOfUser2);





function checkWatchList(userSysID) {



  var watchListString = current.watch_list.toString();



  var watchListArray = watchListString.split(",");





  var onList = false;



  for (var i = 0; i <= watchListArray.length; i++) {



  if (watchListArray<i> == userSysID) {



  onList = true;



  }



  }





  if (!onList) {



  watchListArray[watchListArray.length] = userSysID;



  }





  current.watch_list.setValue(watchListArray.join());



}




Simon


Careful with this.   Watch List is defined on the TASK table, and I strongly suspect these two users don't want to be on the watch list for absolutely everything.


You're going to need to define a Dictionary Override on task.watch_list if you want to set its default value for Change only.



You might also want to learn what they're trying to solve by being watch_listed on all changes.  


- Is it that they can't see all changes, but can see stuff they're watch listed on?


- Is it that they want to be CC'd on every discussion of every change?


robjohnwilson
ServiceNow Employee
ServiceNow Employee

you should never be hard-coding sys_id's


Mike Allen
Mega Sage

Instead of scripting this, why don't you just add them to the notifications sent out to the watch list?



Capture.PNG