@salesforce/mcp-provider-lwc-experts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +82 -0
- package/agents/lds/resources/lwc/guides/reference/reference-create-list-info.md +53 -0
- package/agents/lds/resources/lwc/guides/reference/reference-create-record.md +52 -0
- package/agents/lds/resources/lwc/guides/reference/reference-delete-list-info.md +56 -0
- package/agents/lds/resources/lwc/guides/reference/reference-delete-record.md +78 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-info-by-name.md +60 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-infos-by-name.md +55 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-infos-by-object-name.md +64 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-object-info.md +55 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-preferences.md +60 -0
- package/agents/lds/resources/lwc/guides/reference/reference-get-list-records-by-name.md +84 -0
- package/agents/lds/resources/lwc/guides/reference/reference-update-list-info.md +64 -0
- package/agents/lds/resources/lwc/guides/reference/reference-update-list-preferences.md +68 -0
- package/agents/lds/resources/lwc/guides/reference/reference-update-record.md +75 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/lds-wire-adapter-types.json +1330 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-count.md +58 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info-batch.md +29 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info.md +36 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records-batch.md +48 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records.md +34 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-lists-info.md +28 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-info.md +51 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-infos.md +54 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values-record.md +29 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values.md +78 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-record.md +114 -0
- package/agents/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-records.md +142 -0
- package/index.bundle.d.ts +10 -0
- package/index.bundle.js +375 -0
- package/package.json +49 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Terms of Use
|
|
2
|
+
|
|
3
|
+
Copyright 2025 Salesforce, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
These Terms of Use govern the download, installation, and/or use of this software provided by Salesforce, Inc. (“Salesforce”) (the “Software”), were last updated on April 15, 2022, and constitute a legally binding agreement between you and Salesforce. If you do not agree to these Terms of Use, do not install or use the Software. The Software may link to third-party software components licensed under various open source licenses (“Open Source Components”). These Terms of Use pertain solely to Salesforce's proprietary code in the Software. It does not alter or extend any rights or obligations regarding the Open Source Components. For clarity, your use of the Open Source Components is governed by the terms of the applicable open source license(s). You are solely responsible for complying with the terms and conditions of those open source licenses.
|
|
6
|
+
|
|
7
|
+
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the Software and derivative works subject to these Terms. These Terms shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
Subject to the limited rights expressly granted hereunder, Salesforce reserves all rights, title, and interest in and to all intellectual property subsisting in the Software. No rights are granted to you hereunder other than as expressly set forth herein. Users residing in countries on the United States Office of Foreign Assets Control sanction list, or which are otherwise subject to a US export embargo, may not use the Software.
|
|
10
|
+
|
|
11
|
+
Implementation of the Software may require development work, for which you are responsible. The Software may contain bugs, errors and incompatibilities and is made available on an AS IS basis without support, updates, or service level commitments.
|
|
12
|
+
|
|
13
|
+
Salesforce reserves the right at any time to modify, suspend, or discontinue, the Software (or any part thereof) with or without notice. You agree that Salesforce shall not be liable to you or to any third party for any modification, suspension, or discontinuance.
|
|
14
|
+
|
|
15
|
+
You agree to defend Salesforce against any claim, demand, suit or proceeding made or brought against Salesforce by a third party arising out of or accruing from (a) your use of the Software, and (b) any application you develop with the Software that infringes any copyright, trademark, trade secret, trade dress, patent, or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy (each a “Claim Against Salesforce”), and will indemnify Salesforce from any damages, attorney fees, and costs finally awarded against Salesforce as a result of, or for any amounts paid by Salesforce under a settlement approved by you in writing of, a Claim Against Salesforce, provided Salesforce (x) promptly gives you written notice of the Claim Against Salesforce, (y) gives you sole control of the defense and settlement of the Claim Against Salesforce (except that you may not settle any Claim Against Salesforce unless it unconditionally releases Salesforce of all liability), and (z) gives you all reasonable assistance, at your expense.
|
|
16
|
+
|
|
17
|
+
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT SUPPORTED AND IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA, OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
18
|
+
|
|
19
|
+
These Terms of Use shall be governed exclusively by the internal laws of the State of California, without regard to its conflicts of laws rules. Each party hereby consents to the exclusive jurisdiction of the state and federal courts located in San Francisco County, California to adjudicate any dispute arising out of or relating to these Terms of Use and the download, installation, and/or use of the Software. Except as expressly stated herein, these Terms of Use constitute the entire agreement between the parties, and supersede all prior and contemporaneous agreements, proposals, or representations, written or oral, concerning their subject matter. No modification, amendment, or waiver of any provision of these Terms of Use shall be effective unless it is by an update to these Terms of Use that Salesforce makes available, or is in writing and signed by the party against whom the modification, amendment, or waiver is to be asserted.
|
|
20
|
+
|
|
21
|
+
Data Privacy: Salesforce may collect, process, and store device, system, and other information related to your use of the Software. This information includes, but is not limited to, IP address, user metrics, and other data (“Usage Data”). Salesforce may use Usage Data for analytics, product development, and marketing purposes. You acknowledge that files generated in conjunction with the Software may contain sensitive or confidential data, and you are solely responsible for anonymizing and protecting such data.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @salesforce/mcp-provider-lwc-experts
|
|
2
|
+
|
|
3
|
+
A comprehensive collection of Model Context Protocol (MCP) tools for Lightning Web Component (LWC) development, analysis, and improvement. This package provides AI-powered tools accessible through MCP-compatible clients to analyze, review, and enhance LWC code for accessibility, performance, security, and best practices.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### LWC Development Tools
|
|
8
|
+
|
|
9
|
+
- **Component Creation**: Step-by-step guidance for creating LWC components
|
|
10
|
+
- **Component Optimization**: Performance optimization workflows and best practices
|
|
11
|
+
- **Component Testing**: Jest test generation and testing workflows
|
|
12
|
+
- **Best Practices**: Modern LWC development standards and patterns
|
|
13
|
+
|
|
14
|
+
### Accessibility & Design System Tools
|
|
15
|
+
|
|
16
|
+
- **Accessibility Analysis**: WCAG 2.2 compliance and accessibility testing
|
|
17
|
+
- **SLDS2 Uplift**: Salesforce Lightning Design System v2 migration tools
|
|
18
|
+
- **RTL Support**: Right-to-left language internationalization guidance
|
|
19
|
+
- **Design System Compliance**: SLDS component usage and token-based styling
|
|
20
|
+
|
|
21
|
+
### Data & API Analysis Tools
|
|
22
|
+
|
|
23
|
+
- **LDS Framework Analysis**: Lightning Data Service patterns and consistency
|
|
24
|
+
- **Component API Analysis**: LWC component API surface analysis
|
|
25
|
+
- **Library API Analysis**: LWC library API exploration
|
|
26
|
+
- **Namespace Exploration**: LWC module discovery and analysis
|
|
27
|
+
|
|
28
|
+
### Security & Quality Tools
|
|
29
|
+
|
|
30
|
+
- **Security Review**: Vulnerability analysis and security best practices
|
|
31
|
+
- **Jest Test Review**: Test quality analysis and enhancement
|
|
32
|
+
- **Migration Tools**: Aura to LWC migration completeness analysis
|
|
33
|
+
- **Figma Integration**: Design-to-code conversion guidance
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @salesforce/mcp-provider-lwc-experts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
This package provides MCP tools that can be used with any MCP-compatible client. The tools are organized into two categories:
|
|
44
|
+
|
|
45
|
+
### Instruction-Only Tools
|
|
46
|
+
|
|
47
|
+
Static guidance tools that provide best practices and workflows without requiring LLM API access:
|
|
48
|
+
|
|
49
|
+
- `LWC_Guide_Development` - Core development guidelines
|
|
50
|
+
- `LWC_Guide_BestPractices` - Modern LWC standards and patterns
|
|
51
|
+
- `LWC_Create_Component` - Component creation instructions
|
|
52
|
+
- `LWC_Workflow_Component_Creation` - End-to-end component creation workflow
|
|
53
|
+
- `LWC_Workflow_Component_Optimization` - Performance optimization guidance
|
|
54
|
+
- `LWC_Workflow_Component_Testing` - Complete testing workflow
|
|
55
|
+
- `Figma_Guide_LWC_Conversion` - Design conversion guidance
|
|
56
|
+
- `LWC_Guide_Accessibility` - Accessibility guidelines
|
|
57
|
+
- `LDS_Guide_Development` - Lightning Design System guidelines
|
|
58
|
+
- `LDS_Guide_Data_Consistency` - Data consistency patterns
|
|
59
|
+
- `LWC_Guide_RTL` - RTL internationalization guidelines
|
|
60
|
+
- `LDS_Guide_Referential_Integrity` - Referential integrity patterns
|
|
61
|
+
- `LDS_Explore_UIAPI` - LDS UIAPI Directory knowledge
|
|
62
|
+
- `Aura_Migration_Completeness` - Aura to LWC migration guidelines
|
|
63
|
+
- `LWC_Analyze_Component_API` - Component API analysis
|
|
64
|
+
- `LWC_Analyze_Library_API` - Library API analysis
|
|
65
|
+
- `LWC_Explore_Namespace` - Namespace module exploration
|
|
66
|
+
- `LWC_Guide_Component_Selection` - Component selection recommendations
|
|
67
|
+
- `LWC_Generate_Jest_Tests` - Jest test generation guidance
|
|
68
|
+
- `LWC_Review_Jest_Tests` - Test review and enhancement
|
|
69
|
+
- `LWC_Run_Accessibility_Jest_Tests` - Accessibility testing instructions
|
|
70
|
+
- `LWC_Workflow_SLDS2_Uplift` - SLDS2 migration workflow
|
|
71
|
+
- `LWC_Guide_SLDS2_Uplift_Linter_Fixes` - SLDS2 linter fixes
|
|
72
|
+
- `LWC_Guide_UpliftAiMetadata` - AI metadata enhancement
|
|
73
|
+
|
|
74
|
+
### LLM-Powered Tools
|
|
75
|
+
|
|
76
|
+
Dynamic analysis tools that require LLM API access for intelligent code analysis:
|
|
77
|
+
|
|
78
|
+
- `LWC_Review_Security` - Security vulnerability analysis
|
|
79
|
+
|
|
80
|
+
## MCP Integration
|
|
81
|
+
|
|
82
|
+
To use these tools with an MCP client, configure your MCP client to connect to this package. The tools will be available for use in your AI assistant workflows.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `createListInfo`
|
|
2
|
+
|
|
3
|
+
Creates a list view for a supported object.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { createListInfo } from 'lightning/uiListsApi';
|
|
9
|
+
|
|
10
|
+
createListInfo({ objectApiName: 'Account', listViewApiName: 'MyAccountListView' });
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
- **`objectApiName`** (String, Required) – API name of a supported object.
|
|
16
|
+
- **`listViewApiName`** (String, Required) – API name of a list view (e.g., `"AllAccounts"`).
|
|
17
|
+
- **`displayColumns`** (String[]) – Field API names displayed in the list.
|
|
18
|
+
- **`filterLogicString`** (String) – Filter logic (e.g., `"(1 OR 2) and 3"`).
|
|
19
|
+
- **`filteredByInfo`** (Object) – Filtering details
|
|
20
|
+
- **`label`** (String) – Display label for the list.
|
|
21
|
+
- **`listShares`** (String[]) – Objects shared with if `visibility = "Shared"`.
|
|
22
|
+
- **`scope`** (Object) – Scope details
|
|
23
|
+
- **`visibility`** (String) – One of `"Private"`, `"Public"`, or `"Shared"`.
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
- **`data`** – List Info
|
|
28
|
+
- **`error`** – FetchResponse.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Creates a list view when the button is clicked.
|
|
33
|
+
|
|
34
|
+
### JavaScript
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { createListInfo } from 'lightning/uiListsApi';
|
|
38
|
+
import { LightningElement } from 'lwc';
|
|
39
|
+
|
|
40
|
+
export default class CreateListInfo extends LightningElement {
|
|
41
|
+
error;
|
|
42
|
+
displayColumns;
|
|
43
|
+
|
|
44
|
+
async createListView() {
|
|
45
|
+
createListInfo({
|
|
46
|
+
objectApiName: 'Account',
|
|
47
|
+
listViewApiName: 'AllAccounts',
|
|
48
|
+
})
|
|
49
|
+
.then(({ data }) => (this.displayColumns = data.displayColumns))
|
|
50
|
+
.catch(({ body }) => (this.error = body.message));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# `createRecord(recordInput)`
|
|
2
|
+
|
|
3
|
+
Creates a record.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { createRecord } from 'lightning/uiRecordApi';
|
|
9
|
+
createRecord(recordInput: Record): Promise<Record>;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
- **`recordInput`** (Object, Required) – A RecordInput object used to create the record.
|
|
15
|
+
|
|
16
|
+
### `recordInput` Properties
|
|
17
|
+
|
|
18
|
+
- **`apiName`** (String, Required) – API name of a supported object.
|
|
19
|
+
- **`fields`** (Object) – Map of field names to field values.
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
A Promise that resolves with the created record, containing data for the fields in the record layout.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Use `createRecord` by passing in a `recordInput` object with `apiName` and `fields` properties.
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { createRecord } from 'lightning/uiRecordApi';
|
|
31
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
32
|
+
import NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
33
|
+
|
|
34
|
+
export default class CreateRecordExample extends LightningElement {
|
|
35
|
+
name;
|
|
36
|
+
|
|
37
|
+
handleInput(event) {
|
|
38
|
+
this.name = event.target.value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async handleCreate() {
|
|
42
|
+
const fields = { [NAME_FIELD.fieldApiName]: this.name };
|
|
43
|
+
const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const account = await createRecord(recordInput);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
// Handle error
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# `deleteListInfo`
|
|
2
|
+
|
|
3
|
+
Use this function to delete a list view.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { deleteListInfo } from 'lightning/uiListsApi';
|
|
9
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
10
|
+
|
|
11
|
+
deleteListInfo({ objectApiName: ACCOUNT_OBJECT, listViewApiName: 'MyAccountListView' });
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
17
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
If a list view is deleted successfully, there is no response.
|
|
22
|
+
In case of an error, it returns:
|
|
23
|
+
|
|
24
|
+
- **`error`** – FetchResponse
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
This example deletes a list view when the button is clicked.
|
|
29
|
+
|
|
30
|
+
### **JavaScript**
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { deleteListInfo } from 'lightning/uiListsApi';
|
|
34
|
+
import { LightningElement, api } from 'lwc';
|
|
35
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
36
|
+
|
|
37
|
+
export default class DeleteListInfo extends LightningElement {
|
|
38
|
+
errorMessage;
|
|
39
|
+
deleted;
|
|
40
|
+
|
|
41
|
+
@api async deleteListView() {
|
|
42
|
+
deleteListInfo({
|
|
43
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
44
|
+
listViewApiName: 'AllAccounts_deleteListInfoTest',
|
|
45
|
+
})
|
|
46
|
+
.then(() => {
|
|
47
|
+
this.deleted = true;
|
|
48
|
+
this.errorMessage = undefined;
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
this.errorMessage = error.body.message;
|
|
52
|
+
this.deleted = undefined;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# `deleteRecord(recordId)`
|
|
2
|
+
|
|
3
|
+
Deletes a record.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { deleteRecord } from 'lightning/uiRecordApi';
|
|
9
|
+
deleteRecord(recordId: string): Promise<void>;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
- **`recordId`** (String, Required) – The ID of the record to delete.
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
A `Promise<void>` that resolves when the record is deleted.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
`deleteRecord` accepts a single record ID. To delete multiple records, use `Promise.all()` or Apex.
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { LightningElement, wire } from 'lwc';
|
|
26
|
+
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
27
|
+
import { refreshApex } from '@salesforce/apex';
|
|
28
|
+
import { deleteRecord } from 'lightning/uiRecordApi';
|
|
29
|
+
import getAccountList from '@salesforce/apex/AccountController.getAccountList';
|
|
30
|
+
import { reduceErrors } from 'c/ldsUtils';
|
|
31
|
+
|
|
32
|
+
export default class LdsDeleteRecord extends LightningElement {
|
|
33
|
+
accounts;
|
|
34
|
+
error;
|
|
35
|
+
wiredAccountsResult;
|
|
36
|
+
|
|
37
|
+
@wire(getAccountList)
|
|
38
|
+
wiredAccounts(result) {
|
|
39
|
+
this.wiredAccountsResult = result;
|
|
40
|
+
if (result.data) {
|
|
41
|
+
this.accounts = result.data;
|
|
42
|
+
this.error = undefined;
|
|
43
|
+
} else if (result.error) {
|
|
44
|
+
this.error = result.error;
|
|
45
|
+
this.accounts = undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async deleteAccount(event) {
|
|
50
|
+
const recordId = event.target.dataset.recordid;
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
await deleteRecord(recordId);
|
|
54
|
+
this.dispatchEvent(
|
|
55
|
+
new ShowToastEvent({
|
|
56
|
+
title: 'Success',
|
|
57
|
+
message: 'Account deleted',
|
|
58
|
+
variant: 'success',
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
await refreshApex(this.wiredAccountsResult);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
this.dispatchEvent(
|
|
64
|
+
new ShowToastEvent({
|
|
65
|
+
title: 'Error deleting record',
|
|
66
|
+
message: reduceErrors(error).join(', '),
|
|
67
|
+
variant: 'error',
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Notes
|
|
76
|
+
|
|
77
|
+
- If a component is subscribed to the deleted record via a wire, it will receive a 404 error after deletion.
|
|
78
|
+
- Avoid calling `deleteRecord` from a record page for a record you want to delete, as it will result in a 404 error stating "The requested resource does not exist".
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `getListInfoByName`
|
|
2
|
+
|
|
3
|
+
Use this wire adapter to get the metadata for a list view.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { LightningElement, wire } from 'lwc';
|
|
9
|
+
import { getListInfoByName } from 'lightning/uiListsApi';
|
|
10
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
11
|
+
|
|
12
|
+
export default class Example extends LightningElement {
|
|
13
|
+
@wire(getListInfoByName, {
|
|
14
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
15
|
+
listViewApiName: 'AllAccounts',
|
|
16
|
+
})
|
|
17
|
+
propertyOrFunction;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
24
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
- **`data`** – List Info
|
|
29
|
+
- **`error`** – FetchResponse
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
This example fetches the List Info by API name, then iterates through the list of display columns in the List Info.
|
|
34
|
+
|
|
35
|
+
### **JavaScript**
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { LightningElement, wire } from 'lwc';
|
|
39
|
+
import { getListInfoByName } from 'lightning/uiListsApi';
|
|
40
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
41
|
+
|
|
42
|
+
export default class WireListInfoByName extends LightningElement {
|
|
43
|
+
error;
|
|
44
|
+
displayColumns;
|
|
45
|
+
|
|
46
|
+
@wire(getListInfoByName, {
|
|
47
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
48
|
+
listViewApiName: 'AllAccounts',
|
|
49
|
+
})
|
|
50
|
+
listInfo({ error, data }) {
|
|
51
|
+
if (data) {
|
|
52
|
+
this.displayColumns = data.displayColumns;
|
|
53
|
+
this.error = undefined;
|
|
54
|
+
} else if (error) {
|
|
55
|
+
this.error = error;
|
|
56
|
+
this.displayColumns = undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `getListInfosByName`
|
|
2
|
+
|
|
3
|
+
Use this wire adapter to get the metadata for a batch of list views.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { getListInfosByName } from 'lightning/uiListsApi';
|
|
9
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
10
|
+
|
|
11
|
+
export default class KeywordResults extends LightningElement {
|
|
12
|
+
@wire(getListInfosByName, {
|
|
13
|
+
names: ['Account.AllAccounts'],
|
|
14
|
+
})
|
|
15
|
+
getListInfosByNameWire({ data }) {
|
|
16
|
+
if (data && data.results) {
|
|
17
|
+
this.listInfos = data.results.map(({ result }) => result);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
|
|
25
|
+
- **`names`** (String[], Required) - 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"`.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
- A **`results`** object with Simplified Batch Results and status codes.
|
|
30
|
+
- **`error`** – FetchResponse
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
This example fetches the list information by API name, then iterates through the list of display columns in the list information.
|
|
35
|
+
|
|
36
|
+
### **JavaScript**
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { LightningElement, wire } from 'lwc';
|
|
40
|
+
import { getListInfosByName } from 'lightning/uiListsApi';
|
|
41
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
42
|
+
|
|
43
|
+
export default class WireListInfosByName extends LightningElement {
|
|
44
|
+
listInfos;
|
|
45
|
+
|
|
46
|
+
@wire(getListInfosByName, {
|
|
47
|
+
names: ['${ACCOUNT_OBJECT.objectApiName}.AllAccounts'],
|
|
48
|
+
})
|
|
49
|
+
listInfo({ error, data }) {
|
|
50
|
+
if (data) {
|
|
51
|
+
this.listInfos = data.results.map(({ result }) => result);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# `getListInfosByObjectName`
|
|
2
|
+
|
|
3
|
+
Use this wire to get the list views associated with a supported object.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { LightningElement, wire } from 'lwc';
|
|
9
|
+
import { getListInfosByObjectName } from 'lightning/uiListsApi';
|
|
10
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
11
|
+
|
|
12
|
+
export default class Example extends LightningElement {
|
|
13
|
+
@wire(getListInfosByObjectName, {
|
|
14
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
15
|
+
pageSize: 10,
|
|
16
|
+
recentListsOnly: true,
|
|
17
|
+
})
|
|
18
|
+
propertyOrFunction;
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Parameters
|
|
23
|
+
|
|
24
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
25
|
+
- **`pageSize`** (Number) - The number of list records viewed at one time. The default value is `20`. Valid values are `1–2000`.
|
|
26
|
+
- **`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`.
|
|
27
|
+
- **`q`** (String) - A search term to filter the results. Wildcards are supported.
|
|
28
|
+
- **`recentListsOnly`** (Boolean) - Indicates whether to get recent lists only (`true`) or not (`false`). The default is `false`.
|
|
29
|
+
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
- **`data`** – List Info Summary Collection
|
|
33
|
+
- **`error`** – FetchResponse
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
This example fetches the list of list views for an object and displays the list view labels.
|
|
38
|
+
|
|
39
|
+
### **JavaScript**
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { LightningElement, wire } from 'lwc';
|
|
43
|
+
import { getListInfosByObjectName } from 'lightning/uiListsApi';
|
|
44
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
45
|
+
|
|
46
|
+
export default class GetListOfLists extends LightningElement {
|
|
47
|
+
error;
|
|
48
|
+
lists;
|
|
49
|
+
|
|
50
|
+
@wire(getListInfosByObjectName, {
|
|
51
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
52
|
+
pageSize: 10,
|
|
53
|
+
})
|
|
54
|
+
listOfLists({ error, data }) {
|
|
55
|
+
if (data) {
|
|
56
|
+
this.lists = data.lists;
|
|
57
|
+
this.error = undefined;
|
|
58
|
+
} else if (error) {
|
|
59
|
+
this.error = error;
|
|
60
|
+
this.lists = undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `getListObjectInfo`
|
|
2
|
+
|
|
3
|
+
This wire adapter gets the metadata for a list view object.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { LightningElement, wire } from 'lwc';
|
|
9
|
+
import { getListObjectInfo } from 'lightning/uiListsApi';
|
|
10
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
11
|
+
|
|
12
|
+
export default class Example extends LightningElement {
|
|
13
|
+
@wire(getListObjectInfo, { objectApiName: ACCOUNT_OBJECT })
|
|
14
|
+
propertyOrFunction;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
- **`data`** – List Object Info
|
|
25
|
+
- **`error`** – FetchResponse
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
This example fetches the list object info for an object and then displays the list of columns for the object.
|
|
30
|
+
|
|
31
|
+
### **JavaScript**
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { LightningElement, wire } from 'lwc';
|
|
35
|
+
import { getListObjectInfo } from 'lightning/uiListsApi';
|
|
36
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
37
|
+
|
|
38
|
+
export default class WireListInfoByName extends LightningElement {
|
|
39
|
+
error;
|
|
40
|
+
columns;
|
|
41
|
+
|
|
42
|
+
@wire(getListObjectInfo, {
|
|
43
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
44
|
+
})
|
|
45
|
+
listObjectInfo({ error, data }) {
|
|
46
|
+
if (data) {
|
|
47
|
+
this.columns = data.columns;
|
|
48
|
+
this.error = undefined;
|
|
49
|
+
} else if (error) {
|
|
50
|
+
this.error = error;
|
|
51
|
+
this.columns = undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `getListPreferences`
|
|
2
|
+
|
|
3
|
+
Use this wire adapter to get the preferences for a list view.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { LightningElement, wire } from 'lwc';
|
|
9
|
+
import { getListPreferences } from 'lightning/uiListsApi';
|
|
10
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
11
|
+
|
|
12
|
+
export default class Example extends LightningElement {
|
|
13
|
+
@wire(getListPreferences, {
|
|
14
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
15
|
+
listViewApiName: 'AllAccounts',
|
|
16
|
+
})
|
|
17
|
+
propertyOrFunction;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
24
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
- **`data`** – List Preferences
|
|
29
|
+
- **`error`** – FetchResponse
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
This example fetches the preferences for a list view and displays the column widths for each displayed column.
|
|
34
|
+
|
|
35
|
+
### **JavaScript**
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { LightningElement, wire } from 'lwc';
|
|
39
|
+
import { getListPreferences } from 'lightning/uiListsApi';
|
|
40
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
41
|
+
|
|
42
|
+
export default class GetListPrefs extends LightningElement {
|
|
43
|
+
error;
|
|
44
|
+
columnWidths;
|
|
45
|
+
|
|
46
|
+
@wire(getListPreferences, {
|
|
47
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
48
|
+
listViewApiName: 'AllAccounts',
|
|
49
|
+
})
|
|
50
|
+
listPrefs({ error, data }) {
|
|
51
|
+
if (data) {
|
|
52
|
+
this.columnWidths = Object.entries(data.columnWidths);
|
|
53
|
+
this.error = undefined;
|
|
54
|
+
} else if (error) {
|
|
55
|
+
this.error = error;
|
|
56
|
+
this.columnWidths = undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|