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

Yes. It will apply to all catalog items if the variable name is same in all catalog.



Please mark this response as correct or helpful if it assisted you with your question.

but i am sorry Sanjeev, the name is same but the value of field in each SR is different.


Thanks for the update. It will apply to all the catalog items as long as the variable name is correct. You can also include one more condition to check if the field has a value or not. If it has a value then copy the variable list collector to watch list.


So your modified code should be



if(current.variables.other_interested_parties)


{


current.watch_list = current.variables.other_interested_parties;


}


SanjivMeher
Kilo Patron
Kilo Patron

Write a before business rule in sc_req_item



current.watch_list = current.variables.other_interested_parties;



If you need the watchlist to be populated in catalog task, write a before business rule in sc_task



current.watch_list = current.request_item.variables.other_interested_parties;




Please mark this response as correct or helpful if it assisted you with your question.