How to display Module to specific group

Kishore4321
Tera Contributor

Hi All, 

Requesting your help on below issue.

 

On scoped application we have custom table "Approvals" , it has 4-modules(New, Assigned to me, Assigned to my group, All Approvals).  To this modules we gave roles (admin, approval_user) , so it will be visible to users who are having admin or  table self-role (approval_user).

 

now I want to show "Approvals" Seperator and 'All Approvals' module to one Specific Group too, I tried below script but after using this whole instance modules got effected, complete LEFT Navigation menu not showing. How can it be fixed.

 

 

BR: before , Query, table: sys_app_module, 

f(gs.getUser().isMemberOf('Group A') )

    {

    current.addQuery('sys_id', '5212632ced4f5500by83h692fad873');//sys_id of the 'All Approvals' module

    }

1 ACCEPTED SOLUTION

Iraj Shaikh
Mega Sage
Mega Sage

Hi @Kishore4321 

You are trying to use a Business Rule to control the visibility of a module in the application navigator for a specific group. However, using a Business Rule to directly modify the visibility of navigation modules is not the standard approach in ServiceNow and can lead to issues like the one you're experiencing.

Instead, you should manage the visibility of modules through roles and access controls. Here's how you can achieve your goal without using a Business Rule:

1. Create a new role (if it doesn't already exist) that you want to assign to 'Group A' for the purpose of accessing the 'All Approvals' module.

2. Assign the role to 'Group A':
    - Navigate to the group record for 'Group A'.
    - Go to the 'Roles' related list.
    - Add the new role to this group.

3. Update the module access:
    - Navigate to the 'All Approvals' module under Application Menus in the System Definition.
    - In the 'Roles' tab of the module, add the new role you created.

By doing this, any user who is a member of 'Group A' will inherit the new role and thus gain visibility to the 'All Approvals' module.

If you have already implemented the Business Rule and it has caused issues, you should:

1. Disable or delete the Business Rule 

2. Clear the cache:
    - Sometimes, changes in navigation or security settings may require you to clear the cache.
    - You can do this by typing 'cache.do' in the application navigator and pressing Enter.

3. Test the navigation menu:
     - Log out and log back in to see if the navigation menu is restored to its proper state.

Remember, direct manipulation of system tables like 'sys_app_module' through Business Rules is not recommended and can lead to system-wide issues. Always use the built-in access control mechanisms provided by ServiceNow to manage visibility and access to application components.

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

Iraj Shaikh
Mega Sage
Mega Sage

Hi @Kishore4321 

You are trying to use a Business Rule to control the visibility of a module in the application navigator for a specific group. However, using a Business Rule to directly modify the visibility of navigation modules is not the standard approach in ServiceNow and can lead to issues like the one you're experiencing.

Instead, you should manage the visibility of modules through roles and access controls. Here's how you can achieve your goal without using a Business Rule:

1. Create a new role (if it doesn't already exist) that you want to assign to 'Group A' for the purpose of accessing the 'All Approvals' module.

2. Assign the role to 'Group A':
    - Navigate to the group record for 'Group A'.
    - Go to the 'Roles' related list.
    - Add the new role to this group.

3. Update the module access:
    - Navigate to the 'All Approvals' module under Application Menus in the System Definition.
    - In the 'Roles' tab of the module, add the new role you created.

By doing this, any user who is a member of 'Group A' will inherit the new role and thus gain visibility to the 'All Approvals' module.

If you have already implemented the Business Rule and it has caused issues, you should:

1. Disable or delete the Business Rule 

2. Clear the cache:
    - Sometimes, changes in navigation or security settings may require you to clear the cache.
    - You can do this by typing 'cache.do' in the application navigator and pressing Enter.

3. Test the navigation menu:
     - Log out and log back in to see if the navigation menu is restored to its proper state.

Remember, direct manipulation of system tables like 'sys_app_module' through Business Rules is not recommended and can lead to system-wide issues. Always use the built-in access control mechanisms provided by ServiceNow to manage visibility and access to application components.

Please mark this response as correct or helpful if it assisted you with your question.

Thanks a lot for in-detail details

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Kishore4321 

 

The module accessibility work on role not on group level. So in this case you can create a new role and add that role to that group.

 

I will not repeat as @Iraj Shaikh mentioned the whole step in a beautiful manner and I echo with Iraj 100%.

 

Dont hesitate to accept his answer as solution. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************