LWC 関連リストを取得


import { LightningElement, wire } from 'lwc';
import { getRelatedListRecords } from 'lightning/uiRelatedListApi';

export default class LdsGetRelatedListRecords extends LightningElement {
    @wire(getRelatedListRecords, {
        parentRecordId: '001RM000003UNu6YAG',
        relatedListId: 'Contacts',
        fields: ['Contact.Name','Contact.Id'],
        sortBy: ['Contact.Name']

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. ソートする。 “-” + API Name : 降順

where—(Optional) The filter to apply to related list records, in GraphQL syntax.
  例:{ and: [{ Name: { like: \”%001%\” }}] }