Hide groups

You can hide groups by introducing a hidden field to the group form and then creating a business rule to filter out groups marked as hidden.

Only users in the hidden group will be able to see the hidden field when selecting a group in a reference field.

Add a hidden field to a group form

Add a custom check box field to the group form to allow the group to be hidden by the business rule.

About this task

Procedure

Create a new true/false field labeled Hidden on the Group form.

Result

The system creates new field called u_hidden on the [sys_user_group] table and enables use of the Hidden check box to designate a hidden group.

Add a business rule to filter out hidden groups

After creating a custom field on the group form to hide the group, add a business rule to filter 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 
}