Develop Secure Code
ui*Api Supported Objects
createListInfo
deleteListInfo
getListInfoByName
getListInfosByName
getListInfosByObjectName
getListObjectInfo
getListPreferences
getListRecordsByName
updateListInfoByName
updateListPreferences
getListInfosByNameUse this wire adapter to get the metadata for a batch of list views.
1import { getListInfosByName } from "lightning/uiListsApi";
2import ACCOUNT_OBJECT from "@salesforce/schema/Account";
3
4export default class KeywordResults extends LightningElement {
5 @wire(getListInfosByName, {
6 names: ["Account.AllAccounts"],
7 })
8 getListInfosByNameWire({ data }) {
9 if (data && data.results) {
10 this.listInfos = data.results.map(({ result }) => result);
11 }
12 }
13}1GET /ui-api/list-info/batch?names=Account.AllAccounts,Contact.AllContactsSee Get a Batch of List View Metadata.
| Parameter Name | Type | Description | Required? |
|---|---|---|---|
names | String[] | An array of comma-separated strings of list view names. A list view name starts with an entity name, a dot, and then the name of the list view, like Account.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.results object with Simplified Batch Results and status codes.error—FetchResponseThis code example fetches the list information by API name, then iterates through the list of display columns in the list information.
To retrieve metadata for a single list view, use getListInfoByName instead.
Note
1<!-- wireListInfosByName.html -->
2<template>
3 <lightning-card title="wireListInfosByName">
4 <template for:each={listInfos} for:item="listInfo">
5 <div class="slds-m-around_medium" key={listInfo.id}>
6 <header>{listInfo.listViewApiName}</header>
7 <template for:each={listInfo.displayColumns} for:item="col">
8 <p key={col.fieldApiName}>
9 {col.fieldApiName} : {col.label}
10 </p>
11 </template>
12 </div>
13 </template>
14 </lightning-card>
15</template>1// wireListInfosByName.js
2import { LightningElement, wire } from "lwc";
3import { getListInfosByName } from "lightning/uiListsApi";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5export default class WireListInfosByName extends LightningElement {
6 listInfos;
7 @wire(getListInfosByName, {
8 names: ["${ACCOUNT_OBJECT.objectApiName}.AllAccounts"],
9 })
10 listInfo({ error, data }) {
11 if (data) {
12 this.listInfos = data.results.map(({ result }) => result);
13 }
14 }
15}