Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Add a business rule to filter out hidden groups

Add a business rule to filter out hidden groups

This business rule filters out hidden groups. Only users within the hidden group and users marked admin or groups_admin can see the group.

Create a new "before query" business rule on the sys_user_group (Group) table with the following script:

if (!gs.hasRole("admin") && !gs.hasRole("groups_admin") && gs.getSession().isInteractive()) { 
  var qc = current.addQuery("u_hidden", "!=", "true"); //cannot see hidden groups... 
  qc.addOrCondition("sys_id", "javascript:getMyGroups()"); //...unless in the hidden group 
}