Restrict ability for non-admin users to change views in Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 07:26 AM
Hi Folks,
I have a requirement to restrict the ability for non-admin users to change their view when creating, viewing, or editing an incident. This requirement applies to any form related to the Incident table.
Is it possible to remove the "View" option from the Hamburger icon for users that do no have the admin role? Or, at the very least remove or hide all available views except for the default view?
I followed the instructions here for setting a view rule, but unless I'm doing some wrong when following the instructions this doesn't remove the ability to select a different view. In this case I want to both force the default view for non-admin users and remove the ability to select other views from the Burger icon by either removing the "View" option or removing all none default views from the list.
Thanks
-Weston-

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 07:42 AM
Hi,
hope this will helps you.
https://community.servicenow.com/community?id=community_question&sys_id=0422d721db101fc01dcaf3231f96191c
https://docs.servicenow.com/bundle/jakarta-platform-user-interface/page/script/useful-scripts/reference/r_RestrictFormViewsByRole.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 09:05 AM
Hi Naveen,
Thanks for posting these links. I've read them over and adapted the example script to work on the incident table. The view rule works, but this doesn't remove the view option or restrict with views a non-admin user can select. This is primarily what I would like to lock down.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 09:12 AM
Hi,
Under UI Context menu, search for View and edit the condition for it
ListProperties.canChangeView() && gs.hasRightsTo('ui/context_menu.view/read', null) && !(gs.getUser.hasRole('itil')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 10:02 AM
Hi Vinothkumar,
Thanks for the recommendation. I opened the View context menu, and I found a syntax error in the modified condition you provided. I needed to add an additional closing parenthesis when updating it.
ListProperties.canChangeView() && gs.hasRightsTo('ui/context_menu.view/read', null) && !(gs.getUser.hasRole('itil'))
After saving the form I impersonated an ITIL user (Kathryn Rivera) and opened an incident. While impersonating this user I'm still able to select and change views. Here are the roles that the impersonated account has.
Since I only want this list choice available for Admin users could it be possible to modify the View context menu condition to the following?
ListProperties.canChangeView() && gs.hasRightsTo('ui/context_menu.view/read', null) && (gs.getUser.hasRole('admin'))