ACL restriction based upon variable.

Chad Wilhelm1
Tera Expert

Hello,

We have a requirement to lock down records (REQ and RITM) to one catalog item Spot Bonus.  Those can view would be those with a manager role as long the manger is not the one who getting the spot bonus. There is a variable called user receiving bonus.  I am having issues restricting the manager from seeing it if they are the user in the variable.  Any assistance is appreciated.

find_real_file.png

 

1 ACCEPTED SOLUTION

Use below script 

if(current.request_item.variables.variablename!= gs.getUserID() )
answer=true;

View solution in original post

22 REPLIES 22

Also noticed that you did not do spotuser.addEncodedQuery(queryString); and then before your while look you need spotuser .query();

Chad Wilhelm1
Tera Expert

Unfortunately, it did not work.  This user should not be able to see their own spot bonus.

find_real_file.png

var currentUser = gs.getUserID();
if('variables.1b824ebb133e9700fa7c73076144b072'!= currentUser );
//gs.log(currentUser.getDisplayName());
answer=true;

I just did some testing of the if statement and seems that the system does not know how to evaluate the variable in a script so it is always returning true. I would suggest creating a filed on the table that the workflow copies the variable to using a run script.  Then you could base your ACL on that field.  Or you could also try an glide record query using an encoded query.

Hello,

I have tried multiple iterations of the code nothing seems to work.

find_real_file.png

Use this instead. replace variable name with your vairable

if(current.variables.variablename!= gs.getUserID() )
answer=true;