XML 設定ファイルの要素
HTML テンプレートディレクティブ
HTML テンプレートエラー
デコレータ
@salesforce モジュール
サポートされるオブジェクト
getRelatedListCount
getRelatedListInfo
getRelatedListInfoBatch
getRelatedListRecords
getRelatedListRecordsBatch
getRelatedListsInfo
PageReference の型
getRelatedListsInfoオブジェクトのデフォルトのレイアウトで RelatedLists のメタデータを取得するには、このワイヤアダプタを使用します。
1import { LightningElement, api, wire, track } from 'lwc';
2import { getRelatedListsInfo } from 'lightning/uiRelatedListApi';
3import ACCOUNT_OBJECT from '@salesforce/schema/Account';
4
5export default class LdsGetRelatedListsInfo extends LightningElement {
6 @wire(getRelatedListsInfo, {
7 parentObjectApiName: ACCOUNT_OBJECT.objectApiName,
8 recordTypeId: '012000000000000AAA'// optional
9 })
10}1GET /ui-api/related-list-info/${parentObjectApiName}関連リストの情報の取得に関するページを参照してください。
parentObjectApiName — (必須) 関連リストを取得する必要がある親オブジェクトの API 参照名 (取引先など)。recordTypeId — (省略可能) 親レコードタイプの ID。data — 関連リストの概要のコレクションerror — FetchResponse次のコード例では、親オブジェクトの API 名で関連リストの情報を取得し、レコードのリストを反復処理します。
1<!-- wireGetRelatedListsInfo.html -->
2<template>
3 <lightning-card title="wireGetRelatedListsInfo">
4 <template lwc:if={relatedLists}>
5 <div class="slds-m-around_medium">
6 <template for:each={relatedLists} for:item="relatedList">
7 <p key={relatedList.label}>{relatedList.label}</p>
8 </template>
9 </div>
10 </template>
11 </lightning-card>
12</template>1// wireGetRelatedListsInfo.js
2import { LightningElement, wire } from "lwc";
3import { getRelatedListsInfo } from "lightning/uiRelatedListApi";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5
6export default class WireGetRelatedListsInfo extends LightningElement {
7 error;
8 relatedLists;
9 @wire(getRelatedListsInfo, {
10 parentObjectApiName: ACCOUNT_OBJECT.objectApiName,
11 recordTypeId: "012000000000000AAA", //optional
12 })
13 listInfo({ error, data }) {
14 if (data) {
15 this.relatedLists = data.relatedLists;
16 this.error = undefined;
17 } else if (error) {
18 this.error = error;
19 this.relatedLists = undefined;
20 }
21 }
22}関連トピック
The Japanese Summer '24 guide is now live