Get Related List Metadata
AVAILABLE API VERSION |
---|
API v57.0 and later |
The 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 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 relatedListName: "Opportunities"
.
Query relatedListByName
by following this schema.
The RelatedListInfo
type includes fields for the related list metadata.
The 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.
The ListColumn
type represents metadata for a column in the related list.
The 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.
The ListOrder
type represents the ordering information for a related list.
The ListOrder
type contains these fields.
fieldApiName
: The API name for the field.sortDirection
: The sort order specified by the ResultOrder enum.
The ListOrder
type contains an enum definition for the sortDirection
field.
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.
The previous query returns this response.