Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to hide the Tab in record page in workspace.

vinutha8139
Tera Contributor

Hi All,

I am working on a Configurable Workspace page in UI Builder where I have multiple tabs, including a Playbook tab. My requirement is to show the Playbook tab only for users who have a specific role.

Role:
xyz

Requirement:

  • If the logged-in user has the above role, the Playbook tab should be visible.

  • If the user does not have the role, the Playbook tab should be hidden.

What I Tried:

  1. I added a visibility script in the Playbook tab settings in UI Builder.

function evaluateProperty({api}) {
    if (api.user.hasRole('xyz')) {
        return true;
    }
    return false;
}
  1. I also tried checking user roles using:

function evaluateProperty({api, helpers}) {
  let user_roles = api.context.session.user.roles;
  let visibility_condition = user_roles.includes('xyz');
  return visibility_condition;
}

Issue:
Even after applying the script, the Playbook tab is still visible for users who do not have the role.

Questions:

  1. Is the tab visibility controlled differently in Configurable Workspace?

  2. Is there a recommended way to restrict tab visibility by role?

Any suggestions or best practices would be helpful.

Thanks in advance.

Vinutha

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@vinutha8139 

check this

How hide the Playbook tab based on the conditions in ... 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Dinesh Chilaka
Kilo Sage

Hi @vinutha8139 ,

Same question raised from other Account, does both the persons same or not?

If not ,I have provided the solution in the following post

https://www.servicenow.com/community/developer-forum/how-to-hide-the-tab-in-record-page-in-workspace...

 If my response helped,mark it as helpful and accept the solution.