Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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

 

 

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