How can I auto populate the watch list on an incident?

culk
Kilo Contributor

I'm trying to auto populate the watchlist on an incident on assignment based on 2 things 1) the assigned group and 2) the priority of a call. This is going to be a business rule for us.

My code isn't working yet and because of rustiness I can't figure out where I've gone wrong. Appreciate the help on this

addToWatchList();  

function addToWatchList() {

If   (current.sys_user_group == 'TeamName') {

  var wList = current.watch_list.split(',');    

  var addMe = current.u_escalation_assigned_to;  

  wList.push(addMe);      

  current.watch_list = wList.join(',');      

  current.u_escalation_assigned_to = '';

}

}

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Hi Sean,



Please try this out and let me know



addToWatchList();


function addToWatchList() {


if(current.assignment_group.getDisplayValue() == 'TeamName') {


  var watchlist = current.watch_list;  


  var addMe = current.u_escalation_assigned_to;


  current.watch_list = watchlist + "," + addMe;


  current.u_escalation_assigned_to = '';


}


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

6 REPLIES 6

this thread can be closed. thanks for all the help!


Dave Smith1
ServiceNow Employee
ServiceNow Employee

You just need to mark something as the correct answer and it will then be ticked as "answered", I believe.