Develop Secure Code
ui*Api Supported Objects
createListInfo
deleteListInfo
getListInfoByName
getListInfosByName
getListInfosByObjectName
getListObjectInfo
getListPreferences
getListRecordsByName
updateListInfoByName
updateListPreferences
deleteListInfoUse this wire adapter to delete a list view.
1import { deleteListInfo } from "lightning/uiListsApi";
2import ACCOUNT_OBJECT from "@salesforce/schema/Account";
3
4deleteListInfo({ objectApiName: ACCOUNT_OBJECT, listViewApiName: "MyAccountListView" });1DELETE /ui-api/list-info/${objectApiName}/${listviewApiName}See Delete List View Metadata.
| 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. | ![]() |
If a list view is deleted successfully, there’s no response.
error–FetchResponseThis code example deletes a list view when the button is clicked.
1<!-- wireDeletListInfo.html -->
2<template>
3 <lightning-card title="wireDeleteListInfo">
4 <lightning-button variant="brand" label="Delete List View" title="Primary action" onclick={deleteListView} class="slds-m-left_x-small"></lightning-button>
5 <template lwc:if={deleted}>
6 <p>List View Deleted</p>
7 </template>
8 <template lwc:if={errorMessage}>
9 <p>{errorMessage}</p>
10 </template>
11
12 </lightning-card>
13</template>1// wireDeleteListInfo.js
2import { deleteListInfo } from "lightning/uiListsApi";
3import { LightningElement, api } from "lwc";
4import ACCOUNT_OBJECT from "@salesforce/schema/Account";
5export default class DeleteListInfo extends LightningElement {
6 errorMessage;
7 deleted;
8 @api async deleteListView() {
9 deleteListInfo({
10 objectApiName: ACCOUNT_OBJECT.objectApiName,
11 listViewApiName: "AllAccounts_deleteListInfoTest",
12 })
13 .then(() => {
14 this.deleted = true;
15 this.errorMessage = undefined;
16 })
17 .catch((error) => {
18 this.errorMessage = error.body.message;
19 this.deleted = undefined;
20 });
21 }
22}See Also