Use this wire adapter to get the metadata for
parentObjectApiName—(Required) The API name of a parent object that you want to get related lists for, like an Account.
relatedListId—(Required) The API name of a related list object such as Contacts, Opportunities, or Cases.
recordTypeId—(Optional) The ID of the parent record type. If not provided, the default record type is used.
fields—(Optional) The API names of the related list’s fields to query. If the context user doesn’t have access to a field, or if the field doesn’t exist, an error is returned. If you’re not sure whether the context user has access to a field and you don’t want the request to fail if they don’t, use the
optionalFields—(Optional) The API names of additional fields in the related list to query. If a field is accessible to the context user, it’s included in the response. If a field isn’t accessible to the context user, it isn’t included in the response, but it doesn’t cause an error.
restrictColumnsToLayout—(Optional) Indicates whether to retrieve metadata for only the list columns in the page layout (
true) or all columns (
false). The default value is
true. To further filter columns, use
This code example fetches the metadata for the Contacts related list in the Account object, then iterates through the list of display columns.
- Understand the Wire Service
- Handle Errors in Lightning Data Service
- Salesforce Objects Supported by lightning/ui*Api Modules