Children and Parent Relationships

You can specify a parent or child relationship in your query for the GraphQL wire adapter.

Objects can have children relationships to the same object. For example, a parent account can have a child account. Some objects also have children relationships to other objects. For example, accounts have child relationships to assets, cases, and contacts among other objects.

To query a child relationship, pass in the child relationship name and fields to the parent node. The GraphQL wire adapter only supports one level of child relationships. For example, you can request contacts on an account record, but not any child relationships of those contacts.

The child relationships records in the response are paginated and include cursor and pagination information.

To create a query with children relationships, use the query parameter of the GraphQL wire adapter.

The response looks like this.

To query a parent relationship, pass in the parent relationship name and fields to the child node. The GraphQL wire adapter returns one level of parent relationship. Unlike child relationships, you can request multiple levels of parent relationships. For example, request the name of the account owner associated with an opportunity.

To create a query with parent relationships, use the query parameter of the GraphQL wire adapter.

The response looks like this.

Some relationships fields, like Account.OwnerId, are polymorphic fields. To create a query with polymorphic relationships, use the query parameter of the GraphQL wire adapter and annotate the object using the polymorphicParentRelationship field.

In this example, the OwnerId polymorphic field is mapped to the User object.

The response looks like this.

See Also