Business Rule - Add Opened by to Watchlist

doernbrackc
Kilo Expert

I am trying to check if Opened By has the role "snc_internal" and if so add them to the Watchlist.

find_real_file.png

find_real_file.png

My guess is that my script isn't correct but I don't have much experience with scripting. Any help would be great.

1 ACCEPTED SOLUTION

I figured out my issue. The watchlist that I see on my "case" record is actually on Task which is in global. I was creating the business rule under case so I wasn't able to get access to watch_list and the editor wasn't telling me this was a problem unless I typed current. and could see that it wasn't available. Changing scope fixed this right up.


View solution in original post

4 REPLIES 4

Bharath40
Giga Guru

Hi Chris,



check if watchlist name is as below


var wlist = current.watch_list;


Harish KM
Kilo Patron
Kilo Patron

Servicenow uses '_'(underscore between names). Check your fieldname



var wlist = current.watchlist; // replace to var wlist = current.watch_list;


Regards
Harish

I gave that a shot, doesn't seem to work.



1. If I type current. should I see the option for watch_list? I'm used to Visual Studio but maybe SN doesn't work the same.


2. I also removed the condition for role to see if I could simply get it to work without checking the user role. No luck.


I figured out my issue. The watchlist that I see on my "case" record is actually on Task which is in global. I was creating the business rule under case so I wasn't able to get access to watch_list and the editor wasn't telling me this was a problem unless I typed current. and could see that it wasn't available. Changing scope fixed this right up.