- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:06 AM
I have a button in the portal that needs to be hidden if the logged in user does not have a specific role. Here is my button HTML:
<button
type="button"
class="btn btn-dash {{c.data.view.account == true ? 'selected' : 'unselected'}}"
ng-click="accountOrders()"
id="btnB">
Account Orders
</button>
And then in the Server Script, I have the following script, but the button is not hidden for anyone:
if (
gs.getUser().hasRole(''admin')
) {
accountOrders = true;
} else {
accountOrders = false;
}
ideas?
Solved! Go to Solution.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:13 AM
You can try:
<div ng-show="c.data.accountOrders">
<button
type="button"
class="btn btn-dash {{c.data.view.account == true ? 'selected' : 'unselected'}}"
ng-click="accountOrders()"
id="btnB">
Account Orders
</button>
</div>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:13 AM
You can try:
<div ng-show="c.data.accountOrders">
<button
type="button"
class="btn btn-dash {{c.data.view.account == true ? 'selected' : 'unselected'}}"
ng-click="accountOrders()"
id="btnB">
Account Orders
</button>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:17 AM
Hi Elijah,
This hides the buttons for admins as well (where they should see it based on the server script - I think??)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:27 AM
That might be because your code has a typo. Change your server script to:
if (gs.getUser().hasRole('admin')) {
accountOrders = true;
} else {
accountOrders = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 10:33 AM
No luck, sadly.
Buttin still isn't available for admins in the Portal.