Get Related List Metadata
relatedListByName type returns metadata for a related list in a page layout. The response includes metadata describing fields, relationships, the columns in the list, and the list’s sort order.
Only objects supported by the UI API are available for querying.
Pass in the
relatedListByName type in the
uiapi field. For example, to return metadata for the Opportunity related list on the Account object, use
parentApiName: "Account" and
relatedListByName by following this schema.
RelatedListInfo type includes fields for the related list metadata.
RelatedListInfo type contains these fields.
childApiName: The API name of a supported child object.
displayColumns: All display columns for the related list.
fieldApiName: The API name of the field in the child object that links to the parent object.
label: The related list display label, for example, "Opportunities".
orderedByInfo: Ordering information for the related list.
parentApiName: The API name of a supported parent object.
relatedListName: The name of a supported related list for an object, such as Opportunities.
ListColumn type represents metadata for a column in the related list.
ListColumn type contains these fields.
fieldApiName: The API name for the column field.
label: The label of the column field.
lookupId: The ID of the column field if the field is a reference. If the field isn’t a reference, the value can be null.
sortable: Indicates whether the column is sortable.
ListOrder type represents the ordering information for a related list.
ListOrder type contains these fields.
fieldApiName: The API name for the field.
sortDirection: The sort order specified by the ResultOrder enum.
ListOrder type contains an enum definition for the
ResultOrder enumeration specifies whether the results are ordered in ascending or descending order.
This example fetches the metadata for the Opportunities related list on an Account.
Example Response for Opportunities Related List Metadata for Account
The previous query returns this response.