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.

How to create an ACL to restrict Application/Module Access from a Role

Rae Khan
Tera Contributor

Hi all,

I'm trying to restrict an application from the All dropdown menu from a certain role. 

Is anyone familiar with using a script within an ACL to limit this?

Eg. A user with the 'mobile_analytics_viewer' role should not be able to see the 'Service Portal' from the all dropdown?

 

Any help would be greatly appreciated. 

 

2 REPLIES 2

AnveshKumar M
Tera Sage
Tera Sage

Hi @Rae Khan 

This can be best achieved by a Query Business Rule on sys_app_module.

 

The BR Should be a Query Business Rule and Advanced box is checked.

In the BR Condition check does the user have the mobile_analytics_user like gs.getUser().hasRole('mobile_analytics_viewer')

 

And in the Script fields add a query to filter out the application you don't want to display.

 

current.addQuery('sys_id', '!=', 'sys ID of the service portal module');

 

Please mark my answer helpful and accept as solution if it helped you 👍

Thanks,
Anvesh

Vrushali  Kolte
Mega Sage

Hi @Rae Khan ,

 

To restrict access to an application for a specific role in ServiceNow:

  1. Click on the "Edit Application" button located next to the Application name. From there, add the specific role as demonstrated in the attached image.

    VrushaliKolte_0-1695967478145.png

     

    VrushaliKolte_1-1695967512456.png

     

  2. Alternatively, you can go to the sys_user_role table, open the role record, and include the application along with its module to limit access, as depicted in the provided image.

    VrushaliKolte_2-1695967536415.png

     

If my answer solves your issue please mark it as correct ✔️ and Helpful 👍 based on impact.