updateListInfoByName

Use this wire adapter to update a list view’s metadata.

Syntax 

1import { updateListInfoByName } from "lightning/uiListsApi";
2import ACCOUNT_OBJECT from "@salesforce/schema/Account";
3
4updateListInfoByName({
5  objectApiName: ACCOUNT_OBJECT,
6  listViewApiName: "MyAccountListView",
7  label: "NewListViewLabel",
8});

User Interface API Resource 

1PATCH /ui-api/list-info/${objectApiName}/${listViewApiName}

See Update List View Metadata.

Parameters 

Parameter NameTypeDescriptionRequired?
objectApiNameStringThe API name of a supported object.Yes
listViewApiNameStringThe API name of a list view, such as AllAccounts.Yes
displayColumnsString[]The display columns (field API names) for the list.
filterLogicStringStringThe filter logic string, such as (1 OR 2) and 3. Indexes start with 1.
filteredByInfoObjectFiltering information for the list. Type List Filter By Info Input[].
labelStringThe list’s display label. For example, All Accounts.
listSharesString[]Objects the list is shared with, if visibility is set to Shared.
scopeObjectThe scope information for the list. See List Scope Input.
visibilityStringThe list’s visibility. Valid values are:
  • Private
  • Public
  • Shared
.

Returns 

Usage 

This code example updates the list view’s label on the button click.

1<!-- wireUpdateListInfoByName.html -->
2<template>
3   <lightning-card title="wireUpdateListInfo">
4       <lightning-button variant="brand" label="Update List View" title="Primary action" onclick={updateListView} class="slds-m-left_x-small"></lightning-button>
5       <template lwc:if={label}>
6           <div class="slds-m-around_medium">
7               <p key={label}>New ListView Label: {label}</p>
8           </div>
9       </template>
10   </lightning-card>
11</template>
1// wireUpdateListInfoByName.js
2import { updateListInfoByName } from "lightning/uiListsApi";
3import { LightningElement, api } from "lwc";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5export default class UpdateListInfo extends LightningElement {
6  error;
7  label;
8  @api async updateListView() {
9    updateListInfoByName({
10      objectApiName: ACCOUNT_OBJECT.objectApiName,
11      listViewApiName: "AllAccounts",
12      label: "New Label",
13    })
14      .then((result) => {
15        this.label = result.data.label;
16      })
17      .catch((error) => {
18        this.error = error;
19      });
20  }
21}

See Also