The CreatorCon Call for Content is officially open! Get started here.

How to add people to watchlist automatically

ursnani
Giga Guru

I have a   field on Catalog Item "other_interested_parties"( Referring User Table and its a List Collector). When the user adds users to that field and submit the request then the people in that field should be added automatically to watchlist. I know we can do this after Business Rule (Insert).

Can any one please provide with code which helps me alot.

Thanks

1 ACCEPTED SOLUTION

So your modified code should be



if(current.variables.other_interested_parties)


{


current.watch_list = current.variables.other_interested_parties;


}


View solution in original post

10 REPLIES 10

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Ursnani,



Create a Before business rule on requested item table with insert and update checkbox set to true, with script as


current.watch_list = current.variables.other_interested_parties; //Here I'm assuming other_interested_parties is the VARIABLENAME OF LIST COLLECTOR;


I have many Catalog Items with the same name but different values. so can you please suggest me with an approach on how to achieve this ?


You mean you want to apply to all the catalog items with the same variable name. Can you please give more details.


yes,



i have nearly 7 SR with the same field and same functionality should apply on all of those fields.


example:



i have ABC, BCD, CDS,..... with the same field "Other Interested parties" but the value of those fields are different like abc_other_...., bcd_other_..., cds_other_...,.....


Now when the user submit the request those people in that field should be added to watchlist automatically



Thanks