Menu visibility based on roles in SOW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I need to hide the Incident menu (Assigned to You, Unassigned, Open, Resolved, etc.) in the Service Operations Workspace for users who have both the itil and XY roles.
The expected behavior is:
Users with only the itil role should continue to see the Incident menu.
Users with both itil and XY roles should not see the Incident menu.
I checked List Applicability, but since the user still has the itil role, the menu remains visible due to role-based OR logic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
List Applicability won't work for this because roles are evaluated with OR logic.
Instead, use UI Builder or Workspace Experience visibility conditions. Create a visibility rule or client state that hides the Incident menu when the user has the XY role, even if they also have itil.
If needed, you can also customize the workspace navigation using a script-based visibility condition that checks:
- Show → user has itil
- Hide → user also has XY
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you should ask your customer who wants to see what because that's how the Lists are controlled
you should not handle the reverse i.e. if user has XYZ role then don't show
Approach
-> create audience and handle this using script via user criteria and check the role
check this link where I shared solution yesterday
workspace application menu visibility
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Janaki Raman ,
You need to create the appropriate audience for the "sys_ux_visibility" record to control the visibility of the respective menu.
Please follow the below link :
https://www.servicenow.com/community/developer-forum/how-to-restrict-project-workspace-access/m-p/27...
Please mark helpful & correct answer if it's worthy for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Janaki Raman ,
1.Navigate sys_properties.LIST and set property glide.ux.user_criteria_enabled to true.
2.Navigate to user_criteria.LIST and create a new record
Name - Only ITIL user criteria
Advanced - checked
Script - Use the following script. Replace catalog_admin with the role you want to exclude
(function() {
var hasITIL = false;
var hasRole2 = false;
var role2 = 'catalog_admin'; // Replace with the role you want to exclude
var gr = new GlideRecord('sys_user_has_role');
gr.addQuery('user', user_id);
gr.addQuery('role.name', 'IN', 'itil,' + role2);
gr.query();
while (gr.next()) {
var roleName = gr.role.name.toString();
if (roleName == 'itil')
hasITIL = true;
if (roleName == role2)
hasRole2 = true;
}
// True only when user has itil and does NOT have role2
answer = hasITIL && !hasRole2;
})();Save the record.
3.Navigate to sys_ux_applicability.LIST and create a new record.
Name = Only itil Audience
4.Open the record created in step 3,Now in the related list User Criteria Inclusions click New to create new record.
can Read = Select the User Criteria record created in Step 2 and save
5.Navigate to sys_ux_applicability_m2m_list.LIST and apply filter category = incidents.
6.Update each record with applicability = Only Itil Audience (created in step-3)
7.Now this approach shows the Incident menu only to users who have the ITIL role and do not have the excluded role.