Develop Secure Code
ui*Api Supported Objects
createListInfo
deleteListInfo
getListInfoByName
getListInfosByName
getListInfosByObjectName
getListObjectInfo
getListPreferences
getListRecordsByName
updateListInfoByName
updateListPreferences
getListInfosByObjectNameUse this wire to get the list views associated with a supported object.
1import { LightningElement, wire } from "lwc";
2import { getListInfosByObjectName } from "lightning/uiListsApi";
3import ACCOUNT_OBJECT from "@salesforce/schema/Account";
4
5export default class Example extends LightningElement {
6 @wire(getListInfosByObjectName, {
7 objectApiName: ACCOUNT_OBJECT,
8 pageSize: 10,
9 recentListsOnly: true,
10 })
11 propertyOrFunction;
12}1GET /ui-api/list-info/${objectApiName}See Get List Views for an Object.
| Parameter Name | Type | Description | Required? |
|---|---|---|---|
objectApiName | String | The API name of a supported object. | ![]() |
pageSize | Number | The number of list records viewed at one time. The default value is 20. Valid values are 1–2000. | |
pageToken | Number | A token that represents the page offset. To indicate where the page starts, use this value with the pageSize parameter. The maximum offset is 2000, and the default is 0. | |
q | String | A search term to filter the results. Wildcards are supported. | |
recentListsOnly | Boolean | Indicates whether to get recent lists only (true) or not (false). The default is false. |
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 Info Summary Collectionerror–FetchResponseThis code example fetches the list of list views for an object and displays the list view labels.
1<!-- wireGetListInfosByObjectName.html -->
2<template>
3 <lightning-card title="wireGetListInfosByObjectName">
4 <template lwc:if={lists}>
5 <div class="slds-m-around_medium">
6 <template for:each={lists} for:item="list">
7 <li key={list.label}>{list.label}</li>
8 </template>
9 </div>
10 </template>
11 </lightning-card>
12</template>1// wireGetListInfosByObjectName.js
2import { LightningElement, wire } from "lwc";
3import { getListInfosByObjectName } from "lightning/uiListsApi";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5
6export default class GetListOfLists extends LightningElement {
7 error;
8 lists;
9 @wire(getListInfosByObjectName, {
10 objectApiName: ACCOUNT_OBJECT.objectApiName,
11 pageSize: 10,
12 })
13 listOfLists({ error, data }) {
14 if (data) {
15 this.lists = data.lists;
16 this.error = undefined;
17 debugger;
18 } else if (error) {
19 this.error = error;
20 this.lists = undefined;
21 debugger;
22 }
23 }
24}See Also
Release Preview