Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide "view" context menu option from the form

Jaydee1
Tera Guru

Hi All,

 

I need to hide the "view" context menu from the form. It should only be visible for admin users. I have used following lines of code on context menu condition: 


ListProperties.canChangeView() && gs.hasRightsTo('ui/context_menu.view/read', null) && gs.hasRole('admin')

 

but it's only hiding the option from the list view and not from the form. Attaching the screenshot for the details.

 

Is there any way that we don't remove view_changer role and hide this context menu option from form too?

1 REPLY 1

Community Alums
Not applicable

Hi @Jaydee1 ,

Changing views is granted with the view_changer role on the user or group level. It is not table specific.

If that user is having the view_changer role then they will see that option

you can have view rules defined on that table and ITIL role consists of  view_changer role.