Can you restrict showing a module link by group instead of role?

geek1
Kilo Contributor

Can you restrict showing a module link by group instead of role?

13 REPLIES 13

antonymirza
Tera Expert

Is it a business requirement or you are just doing it for testing purpose? If business requirement then I believe you need to raise a question back to business for this requirement. When roles itself are tagged to group then it should automatically work for group as well.



However, in other way around it can be achieved using scripting, but as Service-Now suggests use scripting only where it is required.



Brgds, AM


benn23
ServiceNow Employee
ServiceNow Employee

Add a new glide_list field to the application and/or module table(s) (ex: u_group_access).


Create before query Business rule(s) against the table(s):


Conditions (this is assuming you only want this to apply to users who have no roles and are only members of groups:


!gs.getUser().hasRoles() && !gs.hasRole('admin')



Script:


qry = 'u_group_accessISEMPTY^ORu_group_accessLIKEjavascript:getMyGroups()';


current.addEncodedQuery(qry);


nickthompson
Kilo Explorer

I have only been able to do this by role, in the Visibility section of the Module (via System Definition>Modules), so although this doesn't really answer the question you have, the only way to limit access to a module is by Role.



If you can add a role to the group, as previously suggested by Jesus Villanueva, and then add that role to the group in question, only the users in that group (who are therefore the only people with that particular role) will be able to see the module in the menu.



Additional thought on the chargeable situation with customised roles:


If these users are already in a group, then they will already have some roles, and be consuming a licence, so there should not be any additional charge for adding a new role to the group. - Although it would be best to check this with your Account Manager in order to be certain.


Just read back my own advice - not very good. I meant to say, create and add the role to the group, then set the visibility filter on the Module to that role. - Only the users with that role can then see the module.