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.

Adding user to watchlist

Shiva Kumar8
Kilo Guru

Hi  Community,

I'm trying to add a user to watchlist whenever an incident is created. SO I created a Business Rule(before insert) on incident table and added the below script but it is not working

(function executeRule(current, previous /*null when async*/) {

	gs.addInfoMessage("BI Group");
	current.watch_list = "usersys_Id here";

})(current, previous);

I tried to remove the toString() as well but still not working

(function executeRule(current, previous /*null when async*/) {

	gs.addInfoMessage("BI Group");
	current.watch_list = "usersys_Id here";

})(current, previous);

I can see the info message if I change the business to after insert, but  the user is still not adding to watchlist. please help

1 ACCEPTED SOLUTION

Shakeel Shaik
Giga Sage
Giga Sage

 

 

current.setValue('watch_list', 'sys_id');
Thanks,
Shakeel Shaik 🙂

View solution in original post

6 REPLIES 6

These are the logs

find_real_file.png