I want to hide a button (UI Action) from users with a certain role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 01:50 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 03:15 PM
Did you check values of all the variables in the condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 03:29 PM
How can I verify the hasRole('auditor') ? I have no idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 03:43 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 03:24 PM
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.