Hide modules even if a user has the correct roles?

ServiceNowSteve
Giga Guru

This is a purely visual request but I a wondering if it is possible to hide modules in the navigator even if a user has the rights to it?

The reason for this request is that we have made a set of tools that all exist under a single application. Each sub set of tools belongs to a specific group so Group A uses tool A, Group B uses tool B and so on...

For one of our tool sets we decided that one of the tools for group A could also be used for group B so we want to redirect group B to that tool when they click on a module under their tool sub section but I don't want them to see Group A's sub section of tools.

Hope that makes sense.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Steve,

The only way to show/hide the left nav modules is based on role.

I had similar requirement earlier to hide the module.

I had tried with query BR on the modules table but that didn't work well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Harsh Vardhan
Giga Patron

you can try with query business rule on your module table and add the logic there to restrict it .

 

Eg: you can refer the below thread. 

https://community.servicenow.com/community?id=community_question&sys_id=d98f4b25dbdcdbc01dcaf3231f96...

Pranav Bhagat
Kilo Sage

I think you can set the role for application menu and dont give the role to users.

Make sure override application menu roles is unchecked .

Pranav

ServiceNowSteve
Giga Guru

Thanks for the suggestions but I don't want to restrict them from that module I actually want them to get to it so limiting it by adding roles won't work I just don't want them to see it.

 

find_real_file.png

See if it helps you. 

 

find_real_file.png

 

I have created 2 groups "Group A" and "Group B".

"ITIL User" belongs to Group A which has also itil role.

"Abel Tuter (Architect)" belongs to "Group B"  which has also itil role.

 

If you see above screenshot this is for admin, admin can see both the separator and modules.

 

Now testing as Group A user means "ITIL User"

 

he can not see those group be 3 modules

 

find_real_file.png

 

Now checking with "Abel Tuter (Architect)", he is member of group B

 

find_real_file.png

 

 

Script:

 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	if(gs.getUser().isMemberOf('Group B')){
		
		current.addQuery('sys_id', '!=', '14641d70c611228501114133b3cc88a1');
		current.addQuery('sys_id', '!=', '283b6424c611228501ffeaea1e115220');
		current.addQuery('sys_id', '!=', 'b55fbec4c0a800090088e83d7ff500de');
		

	}
	else if(gs.getUser().isMemberOf('Group A')){

		current.addQuery('sys_id', '!=', 'bf2c0383c0a801640128cbe631d11c4b');
		current.addQuery('sys_id', '!=', 'cf30af240a0a0b3000ab68fbb64877c9');
		current.addQuery('sys_id', '!=', 'b55b4ab0c0a80009007a9c0f03fb4da9');
		
	}

})(current, previous);