Record producer script to add user to watch_list

M_iA
Kilo Sage

Hello!

I have a record producer and I am trying to write a script for it that checks whether the current user has a specific role and if they do, to add th user to the watch list when the form is submitted.

Please could someone help me out with this?

Thanks

1 ACCEPTED SOLUTION

anubhavritolia
Giga Sage

Hi,

 

Assuming you are talking about Logged in User. Please find code below:

 

if(gs.hasRole('<roleName>')) {
current.watchlist = gs.getUserID();
current.update();
}

 

View solution in original post

5 REPLIES 5

Hi Ricker,

As Record will be created newly so I don't think there would be any value present in watchlist.

 

@M_iA 

In case any Watchlist is also present you can use below line in that case:

current.watchlist = current.watchlist + ',' + gs.getUserID();