getRelatedListRecords
Use this wire adapter to get RelatedList
records. Related lists display details and links to records that are associated with a specific record. For example, an account can have related lists for contacts, cases, notes, or even files.
See Get Related List Records with a Request Body.
The /ui-api/related-list-info/${parentObjectApiName} resource returns related lists for an object, including the relatedListId
values.
parentRecordId
—(Required) The ID of the parent record that you want to get related lists for, like an Account ID.relatedListId
—(Required) The API name of a related list object, like Contacts, Opportunities, or Cases.fields
—(Optional) The API names of the related list’s column fields.optionalFields
—(Optional) The API names of additional fields in the related list.pageSize
—(Optional) The number of list records to return per page.sortBy
—(Optional) An array of field API names to sort the related list by. Accepts only one value per request.where
—(Optional) The filter to apply to related list records, in GraphQL syntax, including relationship filters, and semi-joins and anti-joins etc.
data
—Related List Record Collectionerror
—FetchResponse
This code example fetches the related list records by parent ID and related list object, then iterates through the list of records.
See Also
- Understand the Wire Service
- Handle Errors in Lightning Data Service
- Salesforce Objects Supported by lightning/ui*Api Modules