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

anubhavritolia
Giga Sage

Hello,

 

By Current User, do you mean Logged in User or there is a variable which will store user record?

Its the current logged on user.

Thanks

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();
}

 

That will work but it will clear values (if any) in the watchlist and run for admin when they don’t have the specific role.