Groups
You can use the group__sys and group_membership__sys query targets to query Vault group and user membership information. This allows you to retrieve, filter, and paginate over a large number of groups in your Vault. Groups are available for query in v18.3+ only.
User & Group Relationships
Section link for User & Group RelationshipsFor relationships between users and groups, both user__sys and group__sys objects have a group_membership_sysr "down" relationship that joins the user__sys and group__sys objects.
The group_membership_sys exposes the following parent relationships:
user__sysrrelationship to theuser__sysobject.group__sysrrelationship to thegroup__sysobject.
Group Queryable Fields
Section link for Group Queryable FieldsThis metadata is only available via VQL query and cannot be retrieved using the standard metadata API.
The following fields are queryable for the group__sys object:
| Name | Description |
|---|---|
name__v | The group name. This field must be unique. |
label__v | UI label for the group. This field must be unique. |
status__v | The current state of the group (Active or Inactive). |
description__sys | The description of the group. |
system_group__sys | Specifies if the group is editable. User-managed groups will have a value of false, while system-managed groups will have a value of true. |
type__sys | Points to group_types__sys standard picklist. |
created_date__v | Timestamp when the group was created. |
created_by__v | ID of a user who created the group. |
modified_date__v | Timestamp when the group was updated. |
modified_by__v | ID of a user who updated the group. |
Group Membership Queryable Fields
Section link for Group Membership Queryable FieldsThis metadata is only available via VQL query and cannot be retrieved using the standard metadata API.
The following fields are queryable for the group_membership__sys object:
| Name | Description |
|---|---|
id | The group membership ID. |
user_id__sys | ID of the user_sys object. |
group_id__sys | ID of the group_sys object. |
Group Query Examples
Section link for Group Query ExamplesThe following are examples of standard group queries.
Simple Group Query
Section link for Simple Group QueryRetrieve all user-managed groups:
SELECT id, name__v, label__v, type__sys
FROM group__sys
WHERE type__sys = 'user_managed__sys'Simple Group Membership Query
Section link for Simple Group Membership QueryRetrieve all group IDs where user with ID 123 is a member:
SELECT group_id__sys
FROM group_membership__sys
WHERE user__sysr.id = 123Users-to-Groups Query
Section link for Users-to-Groups QueryFor all active users, retrieve the user-managed groups the user is a member of:
SELECT id,
(SELECT group__sysr.name__v, group__sysr.label__v
FROM group_membership__sysr
WHERE group__sysr.type__sys = 'user_managed__sys')
FROM user__sys
WHERE status__v = 'active__v'Groups-to-Users Query
Section link for Groups-to-Users QueryFor each user-managed Approvers group, retrieve the active members:
SELECT id,
(SELECT user_id__sys
FROM group_membership__sysr
WHERE user__sysr.status__v = 'active__v')
FROM group__sys
WHERE name__v = 'approvers__c' AND type__sys = 'user_managed__sys'Group Label Query
Section link for Group Label QueryRetrieve the members of the group with the label 'All Product Experts':
SELECT user_id__sys, user__sysr.name__v, user__sysr.email__sys
FROM group_membership__sys
WHERE group__sysr.label__v = 'All Product Experts'Group Name Query
Section link for Group Name QueryRetrieve the members of the group with the name all_product_experts__c:
SELECT user_id__sys, user__sysr.name__v, user__sysr.email__sys
FROM group_membership__sys
WHERE group__sysr.name__v = 'all_product_experts__c'Group ID Query
Section link for Group ID QueryRetrieve the members of the group with the ID '1394917493501':
SELECT user_id__sys, user__sysr.name__v, user__sysr.email__sys
FROM group_membership__sys
WHERE group_id__sys = 1394917493501