Develop Secure Code
ui*Api Supported Objects
createListInfo
deleteListInfo
getListInfoByName
getListInfosByName
getListInfosByObjectName
getListObjectInfo
getListPreferences
getListRecordsByName
updateListInfoByName
updateListPreferences
getListInfoByNameUse this wire adapter to get the metadata for a list view.
1import { LightningElement, wire } from "lwc";
2import { getListInfoByName } from "lightning/uiListsApi";
3import ACCOUNT_OBJECT from "@salesforce/schema/Account";
4
5export default class Example extends LightningElement {
6 @wire(getListInfoByName, { objectApiName: ACCOUNT_OBJECT, listViewApiName: "AllAccounts" })
7 propertyOrFunction;
8}1GET /ui-api/list-info/${objectApiName}/${listViewApiName}| Parameter Name | Type | Description | Required? |
|---|---|---|---|
objectApiName | String | The API name of a supported object. | ![]() |
listViewApiName | String | The API name of a list view, such as AllAccounts. | ![]() |
Read the data that’s returned by the wire adapter using a property or function.
propertyOrFunction—A private property or function that receives the stream of data from the wire service.
@wire, the results are returned to the property’s data property or error property.@wire, the results are returned in an object with a data property and an error property.data—List Infoerror—FetchResponseThis code example fetches the List Info by API name, then iterates through the list of display columns in the List Info.
To retrieve metadata for a batch of list views, use getListInfosByName instead.
Note
1<!-- wireListInfoByName.html -->
2<template>
3 <lightning-card title="wireListInfoByName">
4 <template lwc:if={displayColumns}>
5 <div class="slds-m-around_medium">
6 <template for:each={displayColumns} for:item="col">
7 <p key={col.fieldApiName}>{col.fieldApiName} : {col.label}</p>
8 </template>
9 </div>
10 </template>
11 </lightning-card>
12</template>1// wireListInfoByName.js
2import { LightningElement, wire } from "lwc";
3import { getListInfoByName } from "lightning/uiListsApi";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5export default class WireListInfoByName extends LightningElement {
6 error;
7 displayColumns;
8 @wire(getListInfoByName, {
9 objectApiName: ACCOUNT_OBJECT.objectApiName,
10 listViewApiName: "AllAccounts",
11 })
12 listInfo({ error, data }) {
13 if (data) {
14 this.displayColumns = data.displayColumns;
15 this.error = undefined;
16 } else if (error) {
17 this.error = error;
18 this.displayColumns = undefined;
19 }
20 }
21}See Also