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

I want to hide a button (UI Action) from users with a certain role

ewilks
Giga Expert

In the condition of the UI Action, I currently have the following code: current.canCreate() && !RP.getListControl().isOmitNewButton() && !RP.isRelatedList()

 

I would like to keep anyone who has the role of auditor from seeing this UI Action (button), so I added: && !gs.hasRole('auditor')

 

The entirety of the condition is now:   current.canCreate() && !RP.getListControl().isOmitNewButton() && !RP.isRelatedList() && !gs.hasRole('auditor')

 

I assumed that this would mean, that for a user to see this, they would have to not have the role of auditor.   But when I impersonate an auditor, I still see the button.

 

What am I doing wrong?

16 REPLIES 16

VB9
Kilo Explorer

Did you check values of all the variables in the condition?


How can I verify the hasRole('auditor') ?   I have no idea.


I'm guessing one of your other conditions is erroring out.



Easiest way to verify your conditions is with a test client script. (shift+ctrl+alt+j to open the javascript executor)


Alternatively if you need to test server-side, you can create a scheduled job for testing since scheduled jobs have an "execute now" button.


geoff3
Giga Expert

Try setting the condition to only !gs.hasRole('auditor') and see if it works.   There my be some logic issue with one of the other conditions.