Skip to content

How to Find Vault Relationships

In order to perform VQL queries on Vault objects or documents, the query must use the exact inbound or outbound relationship name. There are several methods for finding the correct relationship name:

Before looking for the relationship name, you must first know:

  • The primary query target.
  • Whether you need the inbound or outbound relationship.

Learn more in About Join Queries.

Refer to the Query Targets documentation for information on relationships when the query target is not documents or a Vault object.

Use the SHOW RELATIONSHIPS clause in a VQL query on the target object to retrieve the queryable relationships on the join target.

For example, the results of aSHOW query on product__v include approved_countries__cr:

{ "name": "approved_countries__cr", "target": "approved_country__c", "type": "inbound" }

This indicates that an inbound relationship exists on the Product object from the Approved Country object, and you can create a subquery using the inbound approved_countries__cr relationship name.

The relationship names to use in queries are exposed in the Document and Object Metadata APIs for fields of type ObjectReference when the objectType is a Vault object.

To find relationships on a document or object, search the metadata response for fields with the following attributes:

AttributeValue to Look ForDescription
typeObjectReferenceConfirms the field references an object.
objectType{object_name__v}Indicates the target is a Vault object. This includes standard objects (__v) and custom objects (__c), but does not include users, groups, or workflows.
relationshipTypereference, parent, child, reference_inbound, reference_outboundDefines the nature of the relationship, which dictates whether you can use a subquery or lookup.
relationshipName{relationship_name__vr} or {relationship_name__cr}The exact name to use in the VQL query. Standard object relationships end in __vr, and custom relationships end in __cr.