Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set users to watch list automatically when choose certain category

AbdulAzeez
Mega Guru

Hello Everyone,

I have a requirement whenever i select a category of "Network" in incident table i must auto-populate 2 users name like user#1 , user#2 in watch list

Please help me out how to achieve this

1 ACCEPTED SOLUTION

Hi Abdul, IN client script use


var a = "sys_idof user1" + ","+ "sys_id of user 2";


g_form.setValue("watch_list", a)


View solution in original post

21 REPLIES 21

Alikutty A
Tera Sage

Hello Abdul,



If you are hardcoding users, then just update their sys_id's separated by comma. Ideally they should be fetched from some other field.



g_form.setValue('watch_list', 'sys_id_1, sys_id_2');



Thank You


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


AbdulAzeez
Mega Guru

Thank Everyone for commenting i got the solution using Client Script, However i would appreciate if anyone can help me out to solve the same issue using BR.



Regarding Marking answer as correct i forget to select the as Question in starting coz of that it has been posted as discussion so i cant mark it as correct. Hopefully next i will start discussion as Question


It is the same for business rule, only difference is using the current object.



current.watch_list = 'sys_id_user_1,sys_id_user_2';


current.update();



Thank You


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


Hi Abdul,



For Br



Write a before update Br which runs when Category changes to Network.



var a = "sys_idof user1" + ","+ "sys_id of user 2";


current.watch_list = a;



Hope this helps you


Sneha,



Last quick info required,



By using BR giving a condition category changes to Network, i   written a BR script and its working fine, later if i change category to Hardware / Software still watch_list is populating the users which actually shouldn't.