@salesforce/afv-skills 1.37.0 → 1.38.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/package.json +1 -1
- package/skills/agentforce-generate/README.md +20 -3
- package/skills/agentforce-generate/SKILL.md +253 -440
- package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
- package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
- package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
- package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
- package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
- package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
- package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
- package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
- package/skills/agentforce-generate/assets/patterns/README.md +3 -3
- package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
- package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
- package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
- package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
- package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
- package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
- package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
- package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
- package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
- package/skills/agentforce-generate/references/actions-reference.md +2 -2
- package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
- package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
- package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
- package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
- package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
- package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
- package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
- package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
- package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
- package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
- package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
- package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-generate/references/examples.md +22 -22
- package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
- package/skills/agentforce-generate/references/known-issues.md +1 -2
- package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
- package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
- package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
- package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
- package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
- package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
- package/skills/agentforce-generate/references/reference-map.md +19 -3
- package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
- package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
- package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
- package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
- package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
- package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
- package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
- package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
- package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
- package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
- package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
- package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
- package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
- package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
- package/skills/design-systems-slds-validate/SKILL.md +14 -13
- package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
- package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
- package/skills/dx-org-devhub-configure/SKILL.md +268 -0
- package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
- package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
- package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
- package/skills/dx-org-manage/SKILL.md +135 -42
- package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
- package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
- package/skills/dx-org-manage/examples/README.md +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
- package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
- package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
- package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
- package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
- package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
- package/skills/dx-org-manage/references/definition_file_options.md +24 -0
- package/skills/dx-org-manage/references/edition_types.md +10 -8
- package/skills/dx-org-manage/references/opening-org.md +11 -12
- package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
- package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
- package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
- package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
- package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
- package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
- package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
- package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
- package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
- package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
- package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
- package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
- package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
- package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
- package/skills/experience-content-media-search/SKILL.md +17 -12
- package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
- package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
- package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
- package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
- package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
- package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
- package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
- package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
- package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
- package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
- package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
- package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
- package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
- package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
- package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
- package/skills/experience-lwc-design-generate/SKILL.md +261 -0
- package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
- package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
- package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
- package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
- package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
- package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
- package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
- package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
- package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
- package/skills/experience-lwc-security-validate/SKILL.md +151 -0
- package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
- package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
- package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
- package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
- package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
- package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
- package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
- package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
- package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
- package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
- package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
- package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
- package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
- package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
- package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
- package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
- package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
- package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
- package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
- package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
- package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
- package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
- package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
- package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
- package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
- package/skills/platform-apex-generate/SKILL.md +8 -7
- package/skills/platform-apex-test-generate/SKILL.md +3 -1
- package/skills/platform-apex-test-run/SKILL.md +9 -8
- package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
- package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
- package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
- package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
- package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
- package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
- package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
- package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
- package/skills/platform-policy-rule-generate/SKILL.md +22 -12
- package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
- package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
- package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
- package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
- package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
- package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
- package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
- package/skills/platform-widget-generate/SKILL.md +3 -5
- package/skills/platform-widget-generate/examples/conditional.json +18 -13
- package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
- package/skills/platform-widget-generate/examples/single-object.json +2 -2
- package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
- package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
- package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
- package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
- package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
- package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
- package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
- package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
|
@@ -0,0 +1,1640 @@
|
|
|
1
|
+
# LDS UI API Adapter Reference
|
|
2
|
+
|
|
3
|
+
Per-adapter API docs (Syntax, Parameters, Returns, Usage) for every UI API wire adapter and imperative method, rendered verbatim from the same source the legacy `explore_lds_uiapi` MCP tool returned. Adapters are grouped by family below; each adapter is a `# \`<adapterName>\``block delimited by`---`. Grep for the backticked name (e.g. `` # `getRecord` ``) to jump to its entry.
|
|
4
|
+
|
|
5
|
+
## Adapter directory
|
|
6
|
+
|
|
7
|
+
### uiRecordApis
|
|
8
|
+
|
|
9
|
+
- `createRecord`
|
|
10
|
+
- `deleteRecord`
|
|
11
|
+
- `getRecord`
|
|
12
|
+
- `getRecords`
|
|
13
|
+
- `updateRecord`
|
|
14
|
+
|
|
15
|
+
### uiListsApis
|
|
16
|
+
|
|
17
|
+
- `createListInfo`
|
|
18
|
+
- `deleteListInfo`
|
|
19
|
+
- `getListInfoByName`
|
|
20
|
+
- `getListInfosByName`
|
|
21
|
+
- `getListInfosByObjectName`
|
|
22
|
+
- `getListObjectInfo`
|
|
23
|
+
- `getListPreferences`
|
|
24
|
+
- `getListRecordsByName`
|
|
25
|
+
- `updateListInfoByName`
|
|
26
|
+
- `updateListPreferences`
|
|
27
|
+
|
|
28
|
+
### uiRelatedListApis
|
|
29
|
+
|
|
30
|
+
- `getRelatedListCount`
|
|
31
|
+
- `getRelatedListInfo`
|
|
32
|
+
- `getRelatedListInfoBatch`
|
|
33
|
+
- `getRelatedListRecords`
|
|
34
|
+
- `getRelatedListRecordsBatch`
|
|
35
|
+
- `getRelatedListsInfo`
|
|
36
|
+
|
|
37
|
+
### uiObjectInfoApis
|
|
38
|
+
|
|
39
|
+
- `getObjectInfo`
|
|
40
|
+
- `getObjectInfos`
|
|
41
|
+
- `getPicklistValuesByRecordType`
|
|
42
|
+
- `getPicklistValues`
|
|
43
|
+
|
|
44
|
+
# `createRecord(recordInput)`
|
|
45
|
+
|
|
46
|
+
Creates a record.
|
|
47
|
+
|
|
48
|
+
## Syntax
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { createRecord } from 'lightning/uiRecordApi';
|
|
52
|
+
createRecord(recordInput: Record): Promise<Record>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Parameters
|
|
56
|
+
|
|
57
|
+
- **`recordInput`** (Object, Required) – A RecordInput object used to create the record.
|
|
58
|
+
|
|
59
|
+
### `recordInput` Properties
|
|
60
|
+
|
|
61
|
+
- **`apiName`** (String, Required) – API name of a supported object.
|
|
62
|
+
- **`fields`** (Object) – Map of field names to field values.
|
|
63
|
+
|
|
64
|
+
## Returns
|
|
65
|
+
|
|
66
|
+
A Promise that resolves with the created record, containing data for the fields in the record layout.
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
Use `createRecord` by passing in a `recordInput` object with `apiName` and `fields` properties.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import { createRecord } from 'lightning/uiRecordApi';
|
|
74
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
75
|
+
import NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
76
|
+
|
|
77
|
+
export default class CreateRecordExample extends LightningElement {
|
|
78
|
+
name;
|
|
79
|
+
|
|
80
|
+
handleInput(event) {
|
|
81
|
+
this.name = event.target.value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async handleCreate() {
|
|
85
|
+
const fields = { [NAME_FIELD.fieldApiName]: this.name };
|
|
86
|
+
const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const account = await createRecord(recordInput);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
// Handle error
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
# `deleteRecord(recordId)`
|
|
100
|
+
|
|
101
|
+
Deletes a record.
|
|
102
|
+
|
|
103
|
+
## Syntax
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
import { deleteRecord } from 'lightning/uiRecordApi';
|
|
107
|
+
deleteRecord(recordId: string): Promise<void>;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Parameters
|
|
111
|
+
|
|
112
|
+
- **`recordId`** (String, Required) – The ID of the record to delete.
|
|
113
|
+
|
|
114
|
+
## Returns
|
|
115
|
+
|
|
116
|
+
A `Promise<void>` that resolves when the record is deleted.
|
|
117
|
+
|
|
118
|
+
## Usage
|
|
119
|
+
|
|
120
|
+
`deleteRecord` accepts a single record ID. To delete multiple records, use `Promise.all()` or Apex.
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
import { LightningElement, wire } from 'lwc';
|
|
124
|
+
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
125
|
+
import { refreshApex } from '@salesforce/apex';
|
|
126
|
+
import { deleteRecord } from 'lightning/uiRecordApi';
|
|
127
|
+
import getAccountList from '@salesforce/apex/AccountController.getAccountList';
|
|
128
|
+
import { reduceErrors } from 'c/ldsUtils';
|
|
129
|
+
|
|
130
|
+
export default class LdsDeleteRecord extends LightningElement {
|
|
131
|
+
accounts;
|
|
132
|
+
error;
|
|
133
|
+
wiredAccountsResult;
|
|
134
|
+
|
|
135
|
+
@wire(getAccountList)
|
|
136
|
+
wiredAccounts(result) {
|
|
137
|
+
this.wiredAccountsResult = result;
|
|
138
|
+
if (result.data) {
|
|
139
|
+
this.accounts = result.data;
|
|
140
|
+
this.error = undefined;
|
|
141
|
+
} else if (result.error) {
|
|
142
|
+
this.error = result.error;
|
|
143
|
+
this.accounts = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async deleteAccount(event) {
|
|
148
|
+
const recordId = event.target.dataset.recordid;
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
await deleteRecord(recordId);
|
|
152
|
+
this.dispatchEvent(
|
|
153
|
+
new ShowToastEvent({
|
|
154
|
+
title: 'Success',
|
|
155
|
+
message: 'Account deleted',
|
|
156
|
+
variant: 'success',
|
|
157
|
+
}),
|
|
158
|
+
);
|
|
159
|
+
await refreshApex(this.wiredAccountsResult);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
this.dispatchEvent(
|
|
162
|
+
new ShowToastEvent({
|
|
163
|
+
title: 'Error deleting record',
|
|
164
|
+
message: reduceErrors(error).join(', '),
|
|
165
|
+
variant: 'error',
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Notes
|
|
174
|
+
|
|
175
|
+
- If a component is subscribed to the deleted record via a wire, it will receive a 404 error after deletion.
|
|
176
|
+
- 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".
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# `getRecord`
|
|
181
|
+
|
|
182
|
+
Use this wire adapter to retrieve a record’s data.
|
|
183
|
+
|
|
184
|
+
## Syntax
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
import { LightningElement, wire } from 'lwc';
|
|
188
|
+
import { getRecord } from 'lightning/uiRecordApi';
|
|
189
|
+
|
|
190
|
+
@wire(getRecord, { recordId: string, fields: string|string[], optionalFields?: string|string[] })
|
|
191
|
+
propertyOrFunction;
|
|
192
|
+
|
|
193
|
+
@wire(getRecord, { recordId: string, layoutTypes: string|string[],
|
|
194
|
+
modes?: string|string[], optionalFields?: string|string[] })
|
|
195
|
+
propertyOrFunction;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Parameters
|
|
199
|
+
|
|
200
|
+
- **`recordId`** (String, Required) – ID of a record from a supported object.
|
|
201
|
+
- **`fields`** (String[]) – Either `fields` or `layoutTypes` is required. A field or an array of fields to return. If a field is inaccessible, an error is returned. Use `optionalFields` if unsure about access.
|
|
202
|
+
- **`layoutTypes`** (String[]) – Either `fields` or `layoutTypes` is required. Specifies the fields to return. Options:
|
|
203
|
+
- **`Compact`** – Retrieves a record’s key fields.
|
|
204
|
+
- **`Full`** – Retrieves a full layout.
|
|
205
|
+
- **`modes`** (String[]) – Optional if `layoutTypes` is specified. Determines which fields to get from a layout. Options:
|
|
206
|
+
- **`Create`** – For UI that lets a user create a record.
|
|
207
|
+
- **`Edit`** – For UI that lets a user edit a record.
|
|
208
|
+
- **`View`** – (Default) For UI that displays a record.
|
|
209
|
+
- **`optionalFields`** (String[]) – Optional fields. If accessible, they’re included; if not, they are ignored without error.
|
|
210
|
+
|
|
211
|
+
## Returns
|
|
212
|
+
|
|
213
|
+
- **`data`** – Record response.
|
|
214
|
+
- **`error`** – FetchResponse.
|
|
215
|
+
|
|
216
|
+
## Usage
|
|
217
|
+
|
|
218
|
+
This example retrieves a record and its field values:
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
import { LightningElement, wire } from 'lwc';
|
|
222
|
+
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
|
|
223
|
+
import NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
224
|
+
import OWNER_NAME_FIELD from '@salesforce/schema/Account.Owner.Name';
|
|
225
|
+
import PHONE_FIELD from '@salesforce/schema/Account.Phone';
|
|
226
|
+
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
|
|
227
|
+
|
|
228
|
+
export default class Example extends LightningElement {
|
|
229
|
+
@wire(getRecord, {
|
|
230
|
+
recordId: '001456789012345678',
|
|
231
|
+
fields: [NAME_FIELD, INDUSTRY_FIELD],
|
|
232
|
+
optionalFields: [PHONE_FIELD, OWNER_NAME_FIELD],
|
|
233
|
+
})
|
|
234
|
+
account;
|
|
235
|
+
|
|
236
|
+
get name() {
|
|
237
|
+
return getFieldValue(this.account.data, NAME_FIELD);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
get phone() {
|
|
241
|
+
return getFieldValue(this.account.data, PHONE_FIELD);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
get industry() {
|
|
245
|
+
return getFieldValue(this.account.data, INDUSTRY_FIELD);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
get owner() {
|
|
249
|
+
return getFieldValue(this.account.data, OWNER_NAME_FIELD);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Error Handling
|
|
255
|
+
|
|
256
|
+
Use a Promise with `then()` and `catch()` blocks. To display errors, use toasts from `lightning/platformShowToastEvent`.
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
import { LightningElement, api, wire } from 'lwc';
|
|
260
|
+
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
261
|
+
import { getRecord } from 'lightning/uiRecordApi';
|
|
262
|
+
|
|
263
|
+
const FIELDS = ['Contact.Name', 'Contact.Phone'];
|
|
264
|
+
|
|
265
|
+
export default class LoadContact extends LightningElement {
|
|
266
|
+
@api recordId;
|
|
267
|
+
contact;
|
|
268
|
+
name;
|
|
269
|
+
phone;
|
|
270
|
+
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
|
|
271
|
+
wiredRecord({ error, data }) {
|
|
272
|
+
if (error) {
|
|
273
|
+
let message = 'Unknown error';
|
|
274
|
+
if (Array.isArray(error.body)) {
|
|
275
|
+
message = error.body.map((e) => e.message).join(', ');
|
|
276
|
+
} else if (typeof error.body.message === 'string') {
|
|
277
|
+
message = error.body.message;
|
|
278
|
+
}
|
|
279
|
+
this.dispatchEvent(
|
|
280
|
+
new ShowToastEvent({
|
|
281
|
+
title: 'Error loading contact',
|
|
282
|
+
message,
|
|
283
|
+
variant: 'error',
|
|
284
|
+
}),
|
|
285
|
+
);
|
|
286
|
+
} else if (data) {
|
|
287
|
+
this.contact = data;
|
|
288
|
+
this.name = this.contact.fields.Name.value;
|
|
289
|
+
this.phone = this.contact.fields.Phone.value;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
# `getRecords`
|
|
298
|
+
|
|
299
|
+
Use this wire adapter to retrieve data for multiple records across different objects or record types.
|
|
300
|
+
|
|
301
|
+
## Syntax
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
import { LightningElement, wire } from 'lwc';
|
|
305
|
+
import { getRecords } from 'lightning/uiRecordApi';
|
|
306
|
+
|
|
307
|
+
@wire(getRecords, { records: [ { recordIds: string[], fields: string[] } ] })
|
|
308
|
+
propertyOrFunction;
|
|
309
|
+
|
|
310
|
+
@wire(getRecords, { records: [ { recordIds: string[], fields: string[], optionalFields?: string[] } ] })
|
|
311
|
+
propertyOrFunction;
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Parameters
|
|
315
|
+
|
|
316
|
+
- **`records`** (Object[], Required) – Array of record requests, which can span multiple objects or record types.
|
|
317
|
+
|
|
318
|
+
### `records` Properties
|
|
319
|
+
|
|
320
|
+
- **`recordIds`** (String[], Required) – Record IDs from supported objects.
|
|
321
|
+
- **`fields`** (String[]) – Fields to return. If a field is inaccessible, an error occurs. Use `optionalFields` if unsure about access.
|
|
322
|
+
- **`optionalFields`** (String[]) – Additional fields to return. Inaccessible fields are ignored without causing an error.
|
|
323
|
+
|
|
324
|
+
## Returns
|
|
325
|
+
|
|
326
|
+
- **`data`** – Batch Results.
|
|
327
|
+
- **`error`** – FetchResponse.
|
|
328
|
+
|
|
329
|
+
## Usage
|
|
330
|
+
|
|
331
|
+
For a single record, use `getRecord`.
|
|
332
|
+
|
|
333
|
+
### Example: Fetching Multiple Records
|
|
334
|
+
|
|
335
|
+
```js
|
|
336
|
+
import { LightningElement, wire } from 'lwc';
|
|
337
|
+
import { getRecords } from 'lightning/uiRecordApi';
|
|
338
|
+
import NAME_FIELD from '@salesforce/schema/User.Name';
|
|
339
|
+
import EMAIL_FIELD from '@salesforce/schema/User.Email';
|
|
340
|
+
|
|
341
|
+
export default class GetRecordsExample extends LightningElement {
|
|
342
|
+
@wire(getRecords, {
|
|
343
|
+
records: [
|
|
344
|
+
{
|
|
345
|
+
recordIds: ['005XXXXXXXXXXXXXXX'],
|
|
346
|
+
fields: [NAME_FIELD],
|
|
347
|
+
optionalFields: [EMAIL_FIELD],
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
wiredRecords;
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Example: Fetching Records Across Multiple Objects
|
|
356
|
+
|
|
357
|
+
```js
|
|
358
|
+
import { LightningElement, wire } from 'lwc';
|
|
359
|
+
import { getRecords } from 'lightning/uiRecordApi';
|
|
360
|
+
import USER_NAME_FIELD from '@salesforce/schema/User.Name';
|
|
361
|
+
import ACCOUNT_NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
362
|
+
|
|
363
|
+
export default class GetRecordsExample extends LightningElement {
|
|
364
|
+
@wire(getRecords, {
|
|
365
|
+
records: [
|
|
366
|
+
{ recordIds: ['005XXXXXXXXXXXXXXX'], fields: [USER_NAME_FIELD] },
|
|
367
|
+
{ recordIds: ['001XXXXXXXXXXXXXXX'], fields: [ACCOUNT_NAME_FIELD] },
|
|
368
|
+
],
|
|
369
|
+
})
|
|
370
|
+
wiredRecords;
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Error Handling
|
|
375
|
+
|
|
376
|
+
Errors are included in the `error` property. To identify subrequest errors, check `data.results[].result`.
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"results": [
|
|
381
|
+
{
|
|
382
|
+
"statusCode": 200,
|
|
383
|
+
"result": {
|
|
384
|
+
"apiName": "Contact",
|
|
385
|
+
"fields": {
|
|
386
|
+
"Name": { "value": "Sean Forbes" },
|
|
387
|
+
"Email": { "value": "sean@edge.com" }
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"statusCode": 400,
|
|
393
|
+
"result": [
|
|
394
|
+
{
|
|
395
|
+
"errorCode": "UNKNOWN_EXCEPTION",
|
|
396
|
+
"message": "Record ID is malformed"
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Example: Handling Errors in LWC
|
|
405
|
+
|
|
406
|
+
```js
|
|
407
|
+
import { LightningElement, api, wire } from 'lwc';
|
|
408
|
+
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
409
|
+
import { getRecords } from 'lightning/uiRecordApi';
|
|
410
|
+
|
|
411
|
+
const FIELDS = ['Contact.Name', 'Contact.Phone'];
|
|
412
|
+
|
|
413
|
+
export default class LoadContact extends LightningElement {
|
|
414
|
+
@api recordId;
|
|
415
|
+
contacts;
|
|
416
|
+
name;
|
|
417
|
+
phone;
|
|
418
|
+
@wire(getRecords, {
|
|
419
|
+
records: [{ recordIds: ['005XXXXXXXXXXXXXXX'], fields: FIELDS }],
|
|
420
|
+
})
|
|
421
|
+
wiredRecord({ error, data }) {
|
|
422
|
+
if (error) {
|
|
423
|
+
let message = error.body.message || 'Unknown error';
|
|
424
|
+
this.dispatchEvent(
|
|
425
|
+
new ShowToastEvent({
|
|
426
|
+
title: 'Error loading contacts',
|
|
427
|
+
message,
|
|
428
|
+
variant: 'error',
|
|
429
|
+
}),
|
|
430
|
+
);
|
|
431
|
+
} else if (data) {
|
|
432
|
+
this.contacts = data;
|
|
433
|
+
this.name = this.contacts.results[0].result.fields.Name.value;
|
|
434
|
+
this.phone = this.contacts.results[0].result.fields.Phone.value;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
# `updateRecord(recordInput, clientOptions)`
|
|
443
|
+
|
|
444
|
+
Updates a record. Provide the record ID in `recordInput`.
|
|
445
|
+
|
|
446
|
+
## Syntax
|
|
447
|
+
|
|
448
|
+
```js
|
|
449
|
+
import { updateRecord } from 'lightning/uiRecordApi';
|
|
450
|
+
updateRecord(recordInput: Record, clientOptions?: Object): Promise<Record>;
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
## Parameters
|
|
454
|
+
|
|
455
|
+
- **`recordInput`** (Object, Required) – A RecordInput object used to update the record.
|
|
456
|
+
- **`clientOptions`** (Object, Optional) – To check for conflicts before updating, pass `{'ifUnmodifiedSince' : lastModifiedDate}` using the `LastModifiedDate` value.
|
|
457
|
+
|
|
458
|
+
### `recordInput` Properties
|
|
459
|
+
|
|
460
|
+
- **`fields`** (Object, Required) – Map of field names to field values.
|
|
461
|
+
- **`apiName`** (String) – Use `null` or omit this property when updating a record.
|
|
462
|
+
- **`triggerOtherEmail`** (Boolean) – For cases, specifies whether to send email to external users. Default: `false`.
|
|
463
|
+
- **`triggerUserEmail`** (Boolean) – For cases or leads, specifies whether to send internal user email notifications. Default: `false`.
|
|
464
|
+
- **`useDefaultRule`** (Boolean) – For cases or leads, specifies whether to use default assignment rules. Default: `false`.
|
|
465
|
+
- **`allowSaveOnDuplicate`** (Boolean) – Specifies whether to save a duplicate record. Default: `false`.
|
|
466
|
+
|
|
467
|
+
## Returns
|
|
468
|
+
|
|
469
|
+
A Promise that resolves with the updated record containing field data.
|
|
470
|
+
|
|
471
|
+
## Usage
|
|
472
|
+
|
|
473
|
+
```js
|
|
474
|
+
import { LightningElement, wire } from 'lwc';
|
|
475
|
+
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
476
|
+
import { updateRecord } from 'lightning/uiRecordApi';
|
|
477
|
+
import { refreshApex } from '@salesforce/apex';
|
|
478
|
+
import getSingleContact from '@salesforce/apex/ContactController.getSingleContact';
|
|
479
|
+
import FIRSTNAME_FIELD from '@salesforce/schema/Contact.FirstName';
|
|
480
|
+
import LASTNAME_FIELD from '@salesforce/schema/Contact.LastName';
|
|
481
|
+
import ID_FIELD from '@salesforce/schema/Contact.Id';
|
|
482
|
+
|
|
483
|
+
export default class UpdateRecordExample extends LightningElement {
|
|
484
|
+
@wire(getSingleContact) contact;
|
|
485
|
+
contactId;
|
|
486
|
+
|
|
487
|
+
updateContact() {
|
|
488
|
+
const fields = {
|
|
489
|
+
[ID_FIELD.fieldApiName]: this.contactId,
|
|
490
|
+
[FIRSTNAME_FIELD.fieldApiName]: this.template.querySelector("[data-field='FirstName']").value,
|
|
491
|
+
[LASTNAME_FIELD.fieldApiName]: this.template.querySelector("[data-field='LastName']").value,
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
updateRecord({ fields })
|
|
495
|
+
.then(() => {
|
|
496
|
+
this.dispatchEvent(
|
|
497
|
+
new ShowToastEvent({
|
|
498
|
+
title: 'Success',
|
|
499
|
+
message: 'Contact updated',
|
|
500
|
+
variant: 'success',
|
|
501
|
+
}),
|
|
502
|
+
);
|
|
503
|
+
return refreshApex(this.contact);
|
|
504
|
+
})
|
|
505
|
+
.catch((error) => {
|
|
506
|
+
this.dispatchEvent(
|
|
507
|
+
new ShowToastEvent({
|
|
508
|
+
title: 'Error updating record',
|
|
509
|
+
message: error.body.message,
|
|
510
|
+
variant: 'error',
|
|
511
|
+
}),
|
|
512
|
+
);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
# `createListInfo`
|
|
521
|
+
|
|
522
|
+
Creates a list view for a supported object.
|
|
523
|
+
|
|
524
|
+
## Syntax
|
|
525
|
+
|
|
526
|
+
```js
|
|
527
|
+
import { createListInfo } from 'lightning/uiListsApi';
|
|
528
|
+
|
|
529
|
+
createListInfo({ objectApiName: 'Account', listViewApiName: 'MyAccountListView' });
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## Parameters
|
|
533
|
+
|
|
534
|
+
- **`objectApiName`** (String, Required) – API name of a supported object.
|
|
535
|
+
- **`listViewApiName`** (String, Required) – API name of a list view (e.g., `"AllAccounts"`).
|
|
536
|
+
- **`displayColumns`** (String[]) – Field API names displayed in the list.
|
|
537
|
+
- **`filterLogicString`** (String) – Filter logic (e.g., `"(1 OR 2) and 3"`).
|
|
538
|
+
- **`filteredByInfo`** (Object) – Filtering details
|
|
539
|
+
- **`label`** (String) – Display label for the list.
|
|
540
|
+
- **`listShares`** (String[]) – Objects shared with if `visibility = "Shared"`.
|
|
541
|
+
- **`scope`** (Object) – Scope details
|
|
542
|
+
- **`visibility`** (String) – One of `"Private"`, `"Public"`, or `"Shared"`.
|
|
543
|
+
|
|
544
|
+
## Returns
|
|
545
|
+
|
|
546
|
+
- **`data`** – List Info
|
|
547
|
+
- **`error`** – FetchResponse.
|
|
548
|
+
|
|
549
|
+
## Usage
|
|
550
|
+
|
|
551
|
+
Creates a list view when the button is clicked.
|
|
552
|
+
|
|
553
|
+
### JavaScript
|
|
554
|
+
|
|
555
|
+
```js
|
|
556
|
+
import { createListInfo } from 'lightning/uiListsApi';
|
|
557
|
+
import { LightningElement } from 'lwc';
|
|
558
|
+
|
|
559
|
+
export default class CreateListInfo extends LightningElement {
|
|
560
|
+
error;
|
|
561
|
+
displayColumns;
|
|
562
|
+
|
|
563
|
+
async createListView() {
|
|
564
|
+
createListInfo({
|
|
565
|
+
objectApiName: 'Account',
|
|
566
|
+
listViewApiName: 'AllAccounts',
|
|
567
|
+
})
|
|
568
|
+
.then(({ data }) => (this.displayColumns = data.displayColumns))
|
|
569
|
+
.catch(({ body }) => (this.error = body.message));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
# `deleteListInfo`
|
|
577
|
+
|
|
578
|
+
Use this function to delete a list view.
|
|
579
|
+
|
|
580
|
+
## Syntax
|
|
581
|
+
|
|
582
|
+
```js
|
|
583
|
+
import { deleteListInfo } from 'lightning/uiListsApi';
|
|
584
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
585
|
+
|
|
586
|
+
deleteListInfo({ objectApiName: ACCOUNT_OBJECT, listViewApiName: 'MyAccountListView' });
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## Parameters
|
|
590
|
+
|
|
591
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
592
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
593
|
+
|
|
594
|
+
## Returns
|
|
595
|
+
|
|
596
|
+
If a list view is deleted successfully, there is no response.
|
|
597
|
+
In case of an error, it returns:
|
|
598
|
+
|
|
599
|
+
- **`error`** – FetchResponse
|
|
600
|
+
|
|
601
|
+
## Usage
|
|
602
|
+
|
|
603
|
+
This example deletes a list view when the button is clicked.
|
|
604
|
+
|
|
605
|
+
### **JavaScript**
|
|
606
|
+
|
|
607
|
+
```js
|
|
608
|
+
import { deleteListInfo } from 'lightning/uiListsApi';
|
|
609
|
+
import { LightningElement, api } from 'lwc';
|
|
610
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
611
|
+
|
|
612
|
+
export default class DeleteListInfo extends LightningElement {
|
|
613
|
+
errorMessage;
|
|
614
|
+
deleted;
|
|
615
|
+
|
|
616
|
+
@api async deleteListView() {
|
|
617
|
+
deleteListInfo({
|
|
618
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
619
|
+
listViewApiName: 'AllAccounts_deleteListInfoTest',
|
|
620
|
+
})
|
|
621
|
+
.then(() => {
|
|
622
|
+
this.deleted = true;
|
|
623
|
+
this.errorMessage = undefined;
|
|
624
|
+
})
|
|
625
|
+
.catch((error) => {
|
|
626
|
+
this.errorMessage = error.body.message;
|
|
627
|
+
this.deleted = undefined;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
# `getListInfoByName`
|
|
636
|
+
|
|
637
|
+
Use this wire adapter to get the metadata for a list view.
|
|
638
|
+
|
|
639
|
+
## Syntax
|
|
640
|
+
|
|
641
|
+
```js
|
|
642
|
+
import { LightningElement, wire } from 'lwc';
|
|
643
|
+
import { getListInfoByName } from 'lightning/uiListsApi';
|
|
644
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
645
|
+
|
|
646
|
+
export default class Example extends LightningElement {
|
|
647
|
+
@wire(getListInfoByName, {
|
|
648
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
649
|
+
listViewApiName: 'AllAccounts',
|
|
650
|
+
})
|
|
651
|
+
propertyOrFunction;
|
|
652
|
+
}
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
## Parameters
|
|
656
|
+
|
|
657
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
658
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
659
|
+
|
|
660
|
+
## Returns
|
|
661
|
+
|
|
662
|
+
- **`data`** – List Info
|
|
663
|
+
- **`error`** – FetchResponse
|
|
664
|
+
|
|
665
|
+
## Usage
|
|
666
|
+
|
|
667
|
+
This example fetches the List Info by API name, then iterates through the list of display columns in the List Info.
|
|
668
|
+
|
|
669
|
+
### **JavaScript**
|
|
670
|
+
|
|
671
|
+
```js
|
|
672
|
+
import { LightningElement, wire } from 'lwc';
|
|
673
|
+
import { getListInfoByName } from 'lightning/uiListsApi';
|
|
674
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
675
|
+
|
|
676
|
+
export default class WireListInfoByName extends LightningElement {
|
|
677
|
+
error;
|
|
678
|
+
displayColumns;
|
|
679
|
+
|
|
680
|
+
@wire(getListInfoByName, {
|
|
681
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
682
|
+
listViewApiName: 'AllAccounts',
|
|
683
|
+
})
|
|
684
|
+
listInfo({ error, data }) {
|
|
685
|
+
if (data) {
|
|
686
|
+
this.displayColumns = data.displayColumns;
|
|
687
|
+
this.error = undefined;
|
|
688
|
+
} else if (error) {
|
|
689
|
+
this.error = error;
|
|
690
|
+
this.displayColumns = undefined;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
698
|
+
# `getListInfosByName`
|
|
699
|
+
|
|
700
|
+
Use this wire adapter to get the metadata for a batch of list views.
|
|
701
|
+
|
|
702
|
+
## Syntax
|
|
703
|
+
|
|
704
|
+
```js
|
|
705
|
+
import { getListInfosByName } from 'lightning/uiListsApi';
|
|
706
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
707
|
+
|
|
708
|
+
export default class KeywordResults extends LightningElement {
|
|
709
|
+
@wire(getListInfosByName, {
|
|
710
|
+
names: ['Account.AllAccounts'],
|
|
711
|
+
})
|
|
712
|
+
getListInfosByNameWire({ data }) {
|
|
713
|
+
if (data && data.results) {
|
|
714
|
+
this.listInfos = data.results.map(({ result }) => result);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
## Parameters
|
|
721
|
+
|
|
722
|
+
- **`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"`.
|
|
723
|
+
|
|
724
|
+
## Returns
|
|
725
|
+
|
|
726
|
+
- A **`results`** object with Simplified Batch Results and status codes.
|
|
727
|
+
- **`error`** – FetchResponse
|
|
728
|
+
|
|
729
|
+
## Usage
|
|
730
|
+
|
|
731
|
+
This example fetches the list information by API name, then iterates through the list of display columns in the list information.
|
|
732
|
+
|
|
733
|
+
### **JavaScript**
|
|
734
|
+
|
|
735
|
+
```js
|
|
736
|
+
import { LightningElement, wire } from 'lwc';
|
|
737
|
+
import { getListInfosByName } from 'lightning/uiListsApi';
|
|
738
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
739
|
+
|
|
740
|
+
export default class WireListInfosByName extends LightningElement {
|
|
741
|
+
listInfos;
|
|
742
|
+
|
|
743
|
+
@wire(getListInfosByName, {
|
|
744
|
+
names: ['${ACCOUNT_OBJECT.objectApiName}.AllAccounts'],
|
|
745
|
+
})
|
|
746
|
+
listInfo({ error, data }) {
|
|
747
|
+
if (data) {
|
|
748
|
+
this.listInfos = data.results.map(({ result }) => result);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
# `getListInfosByObjectName`
|
|
757
|
+
|
|
758
|
+
Use this wire to get the list views associated with a supported object.
|
|
759
|
+
|
|
760
|
+
## Syntax
|
|
761
|
+
|
|
762
|
+
```js
|
|
763
|
+
import { LightningElement, wire } from 'lwc';
|
|
764
|
+
import { getListInfosByObjectName } from 'lightning/uiListsApi';
|
|
765
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
766
|
+
|
|
767
|
+
export default class Example extends LightningElement {
|
|
768
|
+
@wire(getListInfosByObjectName, {
|
|
769
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
770
|
+
pageSize: 10,
|
|
771
|
+
recentListsOnly: true,
|
|
772
|
+
})
|
|
773
|
+
propertyOrFunction;
|
|
774
|
+
}
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
## Parameters
|
|
778
|
+
|
|
779
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
780
|
+
- **`pageSize`** (Number) - The number of list records viewed at one time. The default value is `20`. Valid values are `1–2000`.
|
|
781
|
+
- **`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`.
|
|
782
|
+
- **`q`** (String) - A search term to filter the results. Wildcards are supported.
|
|
783
|
+
- **`recentListsOnly`** (Boolean) - Indicates whether to get recent lists only (`true`) or not (`false`). The default is `false`.
|
|
784
|
+
|
|
785
|
+
## Returns
|
|
786
|
+
|
|
787
|
+
- **`data`** – List Info Summary Collection
|
|
788
|
+
- **`error`** – FetchResponse
|
|
789
|
+
|
|
790
|
+
## Usage
|
|
791
|
+
|
|
792
|
+
This example fetches the list of list views for an object and displays the list view labels.
|
|
793
|
+
|
|
794
|
+
### **JavaScript**
|
|
795
|
+
|
|
796
|
+
```js
|
|
797
|
+
import { LightningElement, wire } from 'lwc';
|
|
798
|
+
import { getListInfosByObjectName } from 'lightning/uiListsApi';
|
|
799
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
800
|
+
|
|
801
|
+
export default class GetListOfLists extends LightningElement {
|
|
802
|
+
error;
|
|
803
|
+
lists;
|
|
804
|
+
|
|
805
|
+
@wire(getListInfosByObjectName, {
|
|
806
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
807
|
+
pageSize: 10,
|
|
808
|
+
})
|
|
809
|
+
listOfLists({ error, data }) {
|
|
810
|
+
if (data) {
|
|
811
|
+
this.lists = data.lists;
|
|
812
|
+
this.error = undefined;
|
|
813
|
+
} else if (error) {
|
|
814
|
+
this.error = error;
|
|
815
|
+
this.lists = undefined;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
---
|
|
822
|
+
|
|
823
|
+
# `getListObjectInfo`
|
|
824
|
+
|
|
825
|
+
This wire adapter gets the metadata for a list view object.
|
|
826
|
+
|
|
827
|
+
## Syntax
|
|
828
|
+
|
|
829
|
+
```js
|
|
830
|
+
import { LightningElement, wire } from 'lwc';
|
|
831
|
+
import { getListObjectInfo } from 'lightning/uiListsApi';
|
|
832
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
833
|
+
|
|
834
|
+
export default class Example extends LightningElement {
|
|
835
|
+
@wire(getListObjectInfo, { objectApiName: ACCOUNT_OBJECT })
|
|
836
|
+
propertyOrFunction;
|
|
837
|
+
}
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
## Parameters
|
|
841
|
+
|
|
842
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
843
|
+
|
|
844
|
+
## Returns
|
|
845
|
+
|
|
846
|
+
- **`data`** – List Object Info
|
|
847
|
+
- **`error`** – FetchResponse
|
|
848
|
+
|
|
849
|
+
## Usage
|
|
850
|
+
|
|
851
|
+
This example fetches the list object info for an object and then displays the list of columns for the object.
|
|
852
|
+
|
|
853
|
+
### **JavaScript**
|
|
854
|
+
|
|
855
|
+
```js
|
|
856
|
+
import { LightningElement, wire } from 'lwc';
|
|
857
|
+
import { getListObjectInfo } from 'lightning/uiListsApi';
|
|
858
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
859
|
+
|
|
860
|
+
export default class WireListInfoByName extends LightningElement {
|
|
861
|
+
error;
|
|
862
|
+
columns;
|
|
863
|
+
|
|
864
|
+
@wire(getListObjectInfo, {
|
|
865
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
866
|
+
})
|
|
867
|
+
listObjectInfo({ error, data }) {
|
|
868
|
+
if (data) {
|
|
869
|
+
this.columns = data.columns;
|
|
870
|
+
this.error = undefined;
|
|
871
|
+
} else if (error) {
|
|
872
|
+
this.error = error;
|
|
873
|
+
this.columns = undefined;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
---
|
|
880
|
+
|
|
881
|
+
# `getListPreferences`
|
|
882
|
+
|
|
883
|
+
Use this wire adapter to get the preferences for a list view.
|
|
884
|
+
|
|
885
|
+
## Syntax
|
|
886
|
+
|
|
887
|
+
```js
|
|
888
|
+
import { LightningElement, wire } from 'lwc';
|
|
889
|
+
import { getListPreferences } from 'lightning/uiListsApi';
|
|
890
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
891
|
+
|
|
892
|
+
export default class Example extends LightningElement {
|
|
893
|
+
@wire(getListPreferences, {
|
|
894
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
895
|
+
listViewApiName: 'AllAccounts',
|
|
896
|
+
})
|
|
897
|
+
propertyOrFunction;
|
|
898
|
+
}
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
## Parameters
|
|
902
|
+
|
|
903
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
904
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
905
|
+
|
|
906
|
+
## Returns
|
|
907
|
+
|
|
908
|
+
- **`data`** – List Preferences
|
|
909
|
+
- **`error`** – FetchResponse
|
|
910
|
+
|
|
911
|
+
## Usage
|
|
912
|
+
|
|
913
|
+
This example fetches the preferences for a list view and displays the column widths for each displayed column.
|
|
914
|
+
|
|
915
|
+
### **JavaScript**
|
|
916
|
+
|
|
917
|
+
```js
|
|
918
|
+
import { LightningElement, wire } from 'lwc';
|
|
919
|
+
import { getListPreferences } from 'lightning/uiListsApi';
|
|
920
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
921
|
+
|
|
922
|
+
export default class GetListPrefs extends LightningElement {
|
|
923
|
+
error;
|
|
924
|
+
columnWidths;
|
|
925
|
+
|
|
926
|
+
@wire(getListPreferences, {
|
|
927
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
928
|
+
listViewApiName: 'AllAccounts',
|
|
929
|
+
})
|
|
930
|
+
listPrefs({ error, data }) {
|
|
931
|
+
if (data) {
|
|
932
|
+
this.columnWidths = Object.entries(data.columnWidths);
|
|
933
|
+
this.error = undefined;
|
|
934
|
+
} else if (error) {
|
|
935
|
+
this.error = error;
|
|
936
|
+
this.columnWidths = undefined;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
---
|
|
943
|
+
|
|
944
|
+
# `getListRecordsByName`
|
|
945
|
+
|
|
946
|
+
Use this wire adapter to get record data for a list view.
|
|
947
|
+
|
|
948
|
+
## Syntax
|
|
949
|
+
|
|
950
|
+
```js
|
|
951
|
+
import { LightningElement, wire } from 'lwc';
|
|
952
|
+
import { getListRecordsByName } from 'lightning/uiListsApi';
|
|
953
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
954
|
+
|
|
955
|
+
export default class Example extends LightningElement {
|
|
956
|
+
@wire(getListRecordsByName, {
|
|
957
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
958
|
+
listViewApiName: 'AllAccounts',
|
|
959
|
+
fields: ['Account.Name', 'Account.Id'],
|
|
960
|
+
sortBy: ['Account.Name'],
|
|
961
|
+
})
|
|
962
|
+
propertyOrFunction;
|
|
963
|
+
}
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
## Parameters
|
|
967
|
+
|
|
968
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
969
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
970
|
+
- **`fields`** (String[]) - Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, an error occurs.
|
|
971
|
+
- **`optionalFields`** (String[]) - Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, no error occurs, and the field isn’t included in the records.
|
|
972
|
+
- **`pageSize`** (Integer) - The number of list records viewed at one time. The default value is `50`. Valid values are `1–2000`.
|
|
973
|
+
- **`searchTerm`** (String) - A search term to filter the results. Wildcards are supported.
|
|
974
|
+
- **`sortBy`** (String) - The API name of the field the list view is sorted by. Preceding with `-` sorts in descending order (e.g., `"-CreatedDate"`).
|
|
975
|
+
- **`where`** (String) - The filter applied to returned records using GraphQL syntax.
|
|
976
|
+
- **`pageToken`** (Integer) - A token that represents the page offset. Use with `pageSize` to control pagination.
|
|
977
|
+
|
|
978
|
+
## Returns
|
|
979
|
+
|
|
980
|
+
- **`data`** – List Record Collection
|
|
981
|
+
- **`error`** – FetchResponse
|
|
982
|
+
|
|
983
|
+
## Usage
|
|
984
|
+
|
|
985
|
+
This example fetches list view records by API name and iterates through the records. The `handleNextPage` click handler retrieves the next set of records.
|
|
986
|
+
|
|
987
|
+
### **JavaScript**
|
|
988
|
+
|
|
989
|
+
```js
|
|
990
|
+
import { LightningElement, wire } from 'lwc';
|
|
991
|
+
import { getListRecordsByName } from 'lightning/uiListsApi';
|
|
992
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
993
|
+
|
|
994
|
+
export default class GetListRecords extends LightningElement {
|
|
995
|
+
error;
|
|
996
|
+
records;
|
|
997
|
+
pageToken;
|
|
998
|
+
nextPageToken;
|
|
999
|
+
|
|
1000
|
+
@wire(getListRecordsByName, {
|
|
1001
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1002
|
+
listViewApiName: 'AllAccounts',
|
|
1003
|
+
fields: ['Account.Id', 'Account.Name'],
|
|
1004
|
+
sortBy: ['Account.Name'],
|
|
1005
|
+
pageSize: 10,
|
|
1006
|
+
pageToken: '$pageToken',
|
|
1007
|
+
})
|
|
1008
|
+
listRecords({ error, data }) {
|
|
1009
|
+
if (data) {
|
|
1010
|
+
this.records = data.records;
|
|
1011
|
+
this.nextPageToken = data?.nextPageToken;
|
|
1012
|
+
this.error = undefined;
|
|
1013
|
+
} else if (error) {
|
|
1014
|
+
this.error = error;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
handleNextPage(event) {
|
|
1019
|
+
event.stopPropagation();
|
|
1020
|
+
if (this.nextPageToken) {
|
|
1021
|
+
this.pageToken = this.nextPageToken;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
For backward pagination, use the `previousPageToken` property returned by `getListRecordsByName`.
|
|
1028
|
+
|
|
1029
|
+
---
|
|
1030
|
+
|
|
1031
|
+
# `updateListInfoByName`
|
|
1032
|
+
|
|
1033
|
+
Use this function to update a list view’s metadata.
|
|
1034
|
+
|
|
1035
|
+
## Syntax
|
|
1036
|
+
|
|
1037
|
+
```js
|
|
1038
|
+
import { updateListInfoByName } from 'lightning/uiListsApi';
|
|
1039
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1040
|
+
|
|
1041
|
+
updateListInfoByName({
|
|
1042
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
1043
|
+
listViewApiName: 'MyAccountListView',
|
|
1044
|
+
label: 'NewListViewLabel',
|
|
1045
|
+
});
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
## Parameters
|
|
1049
|
+
|
|
1050
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
1051
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
1052
|
+
- **`displayColumns`** (String[]) - The display columns (field API names) for the list.
|
|
1053
|
+
- **`filterLogicString`** (String) - The filter logic string, such as `"(1 OR 2) and 3"`. Indexes start with 1.
|
|
1054
|
+
- **`filteredByInfo`** (Object) - Filtering information for the list. See List Filter By Info Input.
|
|
1055
|
+
- **`label`** (String) - The list’s display label. For example, `"All Accounts"`.
|
|
1056
|
+
- **`listShares`** (String[]) - Objects the list is shared with, if `visibility` is set to `Shared`.
|
|
1057
|
+
- **`scope`** (Object) - The scope information for the list. See List Scope Input.
|
|
1058
|
+
- **`visibility`** (String) - The list’s visibility. Valid values are: `"Private"`, `"Public"`, `"Shared"`.
|
|
1059
|
+
|
|
1060
|
+
## Returns
|
|
1061
|
+
|
|
1062
|
+
- **`data`** – List Info
|
|
1063
|
+
- **`error`** – FetchResponse
|
|
1064
|
+
|
|
1065
|
+
## Usage
|
|
1066
|
+
|
|
1067
|
+
This example updates the list view’s label when the button is clicked.
|
|
1068
|
+
|
|
1069
|
+
### **JavaScript**
|
|
1070
|
+
|
|
1071
|
+
```js
|
|
1072
|
+
import { updateListInfoByName } from 'lightning/uiListsApi';
|
|
1073
|
+
import { LightningElement, api } from 'lwc';
|
|
1074
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1075
|
+
|
|
1076
|
+
export default class UpdateListInfo extends LightningElement {
|
|
1077
|
+
error;
|
|
1078
|
+
label;
|
|
1079
|
+
|
|
1080
|
+
@api async updateListView() {
|
|
1081
|
+
updateListInfoByName({
|
|
1082
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1083
|
+
listViewApiName: 'AllAccounts',
|
|
1084
|
+
label: 'New Label',
|
|
1085
|
+
})
|
|
1086
|
+
.then((result) => {
|
|
1087
|
+
this.label = result.data.label;
|
|
1088
|
+
})
|
|
1089
|
+
.catch((error) => {
|
|
1090
|
+
this.error = error;
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
```
|
|
1095
|
+
|
|
1096
|
+
---
|
|
1097
|
+
|
|
1098
|
+
# `updateListPreferences`
|
|
1099
|
+
|
|
1100
|
+
Use this function to update the preferences for a list view.
|
|
1101
|
+
|
|
1102
|
+
## Syntax
|
|
1103
|
+
|
|
1104
|
+
```js
|
|
1105
|
+
import { updateListPreferences } from "lightning/uiListsApi";
|
|
1106
|
+
import ACCOUNT_OBJECT from "@salesforce/schema/Account";
|
|
1107
|
+
|
|
1108
|
+
export default class UpdateListPrefExample extends LightningElement {
|
|
1109
|
+
updateListPreferences({
|
|
1110
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
1111
|
+
listViewApiName: "AllAccounts",
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
## Parameters
|
|
1117
|
+
|
|
1118
|
+
- **`objectApiName`** (String, Required) - The API name of a supported object.
|
|
1119
|
+
- **`listViewApiName`** (String, Required) - The API name of a list view, such as `"AllAccounts"`.
|
|
1120
|
+
- **`columnWidths`** (Object) - The column-width preferences for the list. Pass in a key-value pair with the name of the column and an integer.
|
|
1121
|
+
- **`columnWrap`** (Object) - The column-wrapping preferences for the list. Pass in a key-value pair with the name of the column and a boolean.
|
|
1122
|
+
- **`listReference`** (Object) - The reference information for the list.
|
|
1123
|
+
- **`orderedBy`** (String[]) - The ordering preference for the list. See List Order Input.
|
|
1124
|
+
|
|
1125
|
+
## Returns
|
|
1126
|
+
|
|
1127
|
+
- **`data`** – List Info
|
|
1128
|
+
- **`error`** – FetchResponse
|
|
1129
|
+
|
|
1130
|
+
## Usage
|
|
1131
|
+
|
|
1132
|
+
This example updates a list view’s preferences and displays the updated values.
|
|
1133
|
+
|
|
1134
|
+
### **JavaScript**
|
|
1135
|
+
|
|
1136
|
+
```js
|
|
1137
|
+
import { updateListPreferences } from 'lightning/uiListsApi';
|
|
1138
|
+
import { LightningElement, api } from 'lwc';
|
|
1139
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1140
|
+
|
|
1141
|
+
export default class UpdateListPrefs extends LightningElement {
|
|
1142
|
+
error;
|
|
1143
|
+
columnWidths;
|
|
1144
|
+
|
|
1145
|
+
@api async updateListViewPrefs() {
|
|
1146
|
+
updateListPreferences({
|
|
1147
|
+
objectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1148
|
+
listViewApiName: 'AllAccounts',
|
|
1149
|
+
columnWidths: {
|
|
1150
|
+
Type: 200,
|
|
1151
|
+
'Owner.Alias': 200,
|
|
1152
|
+
Phone: 200,
|
|
1153
|
+
BillingState: 250,
|
|
1154
|
+
Name: 250,
|
|
1155
|
+
},
|
|
1156
|
+
})
|
|
1157
|
+
.then((result) => {
|
|
1158
|
+
this.columnWidths = Object.entries(result.data.columnWidths);
|
|
1159
|
+
})
|
|
1160
|
+
.catch((error) => {
|
|
1161
|
+
this.error = error;
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
---
|
|
1168
|
+
|
|
1169
|
+
# `getRelatedListCount`
|
|
1170
|
+
|
|
1171
|
+
Use this wire adapter to get the `RelatedList` record count.
|
|
1172
|
+
|
|
1173
|
+
## Syntax
|
|
1174
|
+
|
|
1175
|
+
```js
|
|
1176
|
+
import { LightningElement, wire } from 'lwc';
|
|
1177
|
+
import { getRelatedListCount } from 'lightning/uiRelatedListApi';
|
|
1178
|
+
|
|
1179
|
+
export default class LdsGetRelatedListCount extends LightningElement {
|
|
1180
|
+
@wire(getRelatedListCount, {
|
|
1181
|
+
parentRecordId: '<PARENT_RECORD_ID_PLACEHOLDER>',
|
|
1182
|
+
relatedListId: 'Contacts',
|
|
1183
|
+
})
|
|
1184
|
+
}
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
## Parameters
|
|
1188
|
+
|
|
1189
|
+
- **`parentRecordId`** (String, Required) – The ID of the parent record, such as an Account ID.
|
|
1190
|
+
- **`relatedListId`** (String, Required) – The API name of a related list object, such as Contacts, Opportunities, or Cases.
|
|
1191
|
+
- **`maxCount`** (Number) – The maximum number of records to return. Default is 20.
|
|
1192
|
+
|
|
1193
|
+
## Returns
|
|
1194
|
+
|
|
1195
|
+
- **`data`** – Related List Record Count.
|
|
1196
|
+
- **`error`** – FetchResponse.
|
|
1197
|
+
|
|
1198
|
+
## Usage
|
|
1199
|
+
|
|
1200
|
+
This example fetches the record count for a related list.
|
|
1201
|
+
|
|
1202
|
+
### **JavaScript**
|
|
1203
|
+
|
|
1204
|
+
```js
|
|
1205
|
+
import { LightningElement, wire } from 'lwc';
|
|
1206
|
+
import { getRelatedListCount } from 'lightning/uiRelatedListApi';
|
|
1207
|
+
|
|
1208
|
+
export default class WireGetRelatedListCount extends LightningElement {
|
|
1209
|
+
error;
|
|
1210
|
+
responseData;
|
|
1211
|
+
|
|
1212
|
+
@wire(getRelatedListCount, {
|
|
1213
|
+
parentRecordId: '<PARENT_RECORD_ID_PLACEHOLDER>',
|
|
1214
|
+
relatedListId: 'Contacts',
|
|
1215
|
+
})
|
|
1216
|
+
listInfo({ error, data }) {
|
|
1217
|
+
if (data) {
|
|
1218
|
+
this.responseData = data;
|
|
1219
|
+
this.error = undefined;
|
|
1220
|
+
} else if (error) {
|
|
1221
|
+
this.error = error;
|
|
1222
|
+
this.responseData = undefined;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
---
|
|
1229
|
+
|
|
1230
|
+
# `getRelatedListInfo`
|
|
1231
|
+
|
|
1232
|
+
Use this wire adapter to get metadata for `RelatedList`.
|
|
1233
|
+
|
|
1234
|
+
## Syntax
|
|
1235
|
+
|
|
1236
|
+
```js
|
|
1237
|
+
import { LightningElement, wire } from 'lwc';
|
|
1238
|
+
import { getRelatedListInfo } from 'lightning/uiRelatedListApi';
|
|
1239
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1240
|
+
|
|
1241
|
+
export default class LdsGetRelatedListInfo extends LightningElement {
|
|
1242
|
+
@wire(getRelatedListInfo, {
|
|
1243
|
+
parentObjectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1244
|
+
relatedListId: 'Contacts',
|
|
1245
|
+
recordTypeId: '012000000000000AAA', // optional
|
|
1246
|
+
fields: ['Contact.Name', 'Contact.Id'], // optional
|
|
1247
|
+
optionalFields: ['Contact.OptionalField'], // optional
|
|
1248
|
+
restrictColumnsToLayout: false // optional
|
|
1249
|
+
})
|
|
1250
|
+
}
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
## Parameters
|
|
1254
|
+
|
|
1255
|
+
- **`parentObjectApiName`** (String, Required) – API name of a parent object, such as `Account`.
|
|
1256
|
+
- **`relatedListId`** (String, Required) – API name of a related list object, such as `Contacts`, `Opportunities`, or `Cases`.
|
|
1257
|
+
- **`recordTypeId`** (String) – ID of the parent record type. If not provided, the default record type is used.
|
|
1258
|
+
- **`fields`** (String[]) – API names of related list fields to query. If a field is inaccessible, an error is returned.
|
|
1259
|
+
- **`optionalFields`** (String[]) – Additional fields to query. Inaccessible fields are ignored but do not cause an error.
|
|
1260
|
+
- **`restrictColumnsToLayout`** (Boolean) – If `true`, retrieves only list columns in the page layout; if `false`, retrieves all columns. Default is `true`.
|
|
1261
|
+
|
|
1262
|
+
## Returns
|
|
1263
|
+
|
|
1264
|
+
- **`data`** – Related List Info.
|
|
1265
|
+
- **`error`** – FetchResponse.
|
|
1266
|
+
|
|
1267
|
+
---
|
|
1268
|
+
|
|
1269
|
+
# `getRelatedListInfoBatch`
|
|
1270
|
+
|
|
1271
|
+
Use this wire adapter to get metadata for a batch of `RelatedLists`.
|
|
1272
|
+
|
|
1273
|
+
## Syntax
|
|
1274
|
+
|
|
1275
|
+
```js
|
|
1276
|
+
import { LightningElement, wire } from 'lwc';
|
|
1277
|
+
import { getRelatedListInfoBatch } from 'lightning/uiRelatedListApi';
|
|
1278
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1279
|
+
|
|
1280
|
+
export default class LdsGetRelatedListInfoBatch extends LightningElement {
|
|
1281
|
+
@wire(getRelatedListInfoBatch, {
|
|
1282
|
+
parentObjectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1283
|
+
relatedListNames: ['Contacts', 'Opportunities'],
|
|
1284
|
+
})
|
|
1285
|
+
}
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
## Parameters
|
|
1289
|
+
|
|
1290
|
+
- **`parentObjectApiName`** (String, Required) – API name of a parent object, such as `Account`.
|
|
1291
|
+
- **`relatedListNames`** (String[], Required) – Array of related list API names, such as `Contacts`, `Opportunities`, or `Cases`. In the wire adapter code, `relatedListNames` maps to `relatedListIds` in the User Interface API resource.
|
|
1292
|
+
- **`recordTypeId`** (String) – ID of the parent record type. If not provided, the default record type is used.
|
|
1293
|
+
|
|
1294
|
+
## Returns
|
|
1295
|
+
|
|
1296
|
+
- **`data`** – Simplified Batch Results.
|
|
1297
|
+
- **`error`** – FetchResponse.
|
|
1298
|
+
|
|
1299
|
+
---
|
|
1300
|
+
|
|
1301
|
+
# `getRelatedListRecords`
|
|
1302
|
+
|
|
1303
|
+
Use this wire adapter to get `RelatedList` records. Related lists display details and links to records associated with a specific record, such as contacts, cases, notes, or files related to an account.
|
|
1304
|
+
|
|
1305
|
+
## Syntax
|
|
1306
|
+
|
|
1307
|
+
```js
|
|
1308
|
+
import { LightningElement, wire } from 'lwc';
|
|
1309
|
+
import { getRelatedListRecords } from 'lightning/uiRelatedListApi';
|
|
1310
|
+
|
|
1311
|
+
export default class LdsGetRelatedListRecords extends LightningElement {
|
|
1312
|
+
@wire(getRelatedListRecords, {
|
|
1313
|
+
parentRecordId: '<PARENT_RECORD_ID_PLACEHOLDER>',
|
|
1314
|
+
relatedListId: 'Contacts',
|
|
1315
|
+
fields: ['Contact.Name','Contact.Id'],
|
|
1316
|
+
sortBy: ['Contact.Name']
|
|
1317
|
+
})
|
|
1318
|
+
}
|
|
1319
|
+
```
|
|
1320
|
+
|
|
1321
|
+
## Parameters
|
|
1322
|
+
|
|
1323
|
+
- **`parentRecordId`** (String, Required) – ID of the parent record, such as an Account ID.
|
|
1324
|
+
- **`relatedListId`** (String, Required) – API name of a related list or child relationship (e.g., `Contacts`, `Opportunities`, `Cases`). For custom objects, use `Custom_Objects__r`.
|
|
1325
|
+
- **`fields`** (String[]) – API names of the related list’s column fields. For standard fields on custom objects, use `Custom_Object__c.FieldName`; for custom fields, use `Custom_Object__c.FieldName__c`.
|
|
1326
|
+
- **`optionalFields`** (String[]) – Additional fields in the related list.
|
|
1327
|
+
- **`pageSize`** (Number) – Number of records per page (default: 50, range: 1-1999).
|
|
1328
|
+
- **`sortBy`** (String[]) – API name of the field to sort by. Accepts one value per request.
|
|
1329
|
+
- **`where`** (String) – Filter for related list records. Semi-joins and anti-joins are not supported.
|
|
1330
|
+
|
|
1331
|
+
## Returns
|
|
1332
|
+
|
|
1333
|
+
- **`data`** – Related List Record Collection.
|
|
1334
|
+
- **`error`** – FetchResponse.
|
|
1335
|
+
|
|
1336
|
+
---
|
|
1337
|
+
|
|
1338
|
+
# `getRelatedListRecordsBatch`
|
|
1339
|
+
|
|
1340
|
+
Use this wire adapter to get records for a batch of `RelatedLists`.
|
|
1341
|
+
|
|
1342
|
+
## Syntax
|
|
1343
|
+
|
|
1344
|
+
```js
|
|
1345
|
+
import { LightningElement, wire } from 'lwc';
|
|
1346
|
+
import { getRelatedListRecordsBatch } from 'lightning/uiRelatedListApi';
|
|
1347
|
+
|
|
1348
|
+
export default class LdsGetRelatedListRecordsBatch extends LightningElement {
|
|
1349
|
+
@wire(getRelatedListRecordsBatch, {
|
|
1350
|
+
parentRecordId: '<PARENT_RECORD_ID_PLACEHOLDER>',
|
|
1351
|
+
relatedListParameters: [
|
|
1352
|
+
{
|
|
1353
|
+
relatedListId: 'Contacts',
|
|
1354
|
+
fields: ['Contact.Name', 'Contact.Id'],
|
|
1355
|
+
sortBy: ['Contact.Name']
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
relatedListId: 'Opportunities',
|
|
1359
|
+
fields: ['Opportunity.Name', 'Opportunity.Amount'],
|
|
1360
|
+
sortBy: ['Opportunity.Amount'],
|
|
1361
|
+
where: "{ and: [{ Name: { like: \"ACME%\" }}] }"
|
|
1362
|
+
}
|
|
1363
|
+
]
|
|
1364
|
+
})
|
|
1365
|
+
}
|
|
1366
|
+
```
|
|
1367
|
+
|
|
1368
|
+
## Parameters
|
|
1369
|
+
|
|
1370
|
+
- **`parentRecordId`** (String, Required) – ID of the parent record, such as an Account ID.
|
|
1371
|
+
- **`relatedListParameters`** (Object[], Required) – Array of related list parameter collections.
|
|
1372
|
+
|
|
1373
|
+
### **`relatedListParameters` Properties**
|
|
1374
|
+
|
|
1375
|
+
- **`relatedListId`** (String, Required) – API name of a related list object, such as `Contacts`, `Opportunities`, or `Cases`.
|
|
1376
|
+
- **`fields`** (String[]) – API names of the related list’s column fields.
|
|
1377
|
+
- **`optionalFields`** (String[]) – Additional fields in the related list.
|
|
1378
|
+
- **`pageSize`** (Number) – Number of list records to return per page.
|
|
1379
|
+
- **`sortBy`** (String[]) – Field API name(s) to sort by. Accepts one value per request.
|
|
1380
|
+
- **`where`** (String) – Filter for related list records in GraphQL syntax.
|
|
1381
|
+
|
|
1382
|
+
## Returns
|
|
1383
|
+
|
|
1384
|
+
- **`data`** – Simplified Batch Results.
|
|
1385
|
+
- **`error`** – FetchResponse.
|
|
1386
|
+
|
|
1387
|
+
---
|
|
1388
|
+
|
|
1389
|
+
# `getRelatedListsInfo`
|
|
1390
|
+
|
|
1391
|
+
Use this wire adapter to get metadata for `RelatedLists` in an object’s default layout.
|
|
1392
|
+
|
|
1393
|
+
## Syntax
|
|
1394
|
+
|
|
1395
|
+
```js
|
|
1396
|
+
import { LightningElement, wire } from 'lwc';
|
|
1397
|
+
import { getRelatedListsInfo } from 'lightning/uiRelatedListApi';
|
|
1398
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1399
|
+
|
|
1400
|
+
export default class LdsGetRelatedListsInfo extends LightningElement {
|
|
1401
|
+
@wire(getRelatedListsInfo, {
|
|
1402
|
+
parentObjectApiName: ACCOUNT_OBJECT.objectApiName,
|
|
1403
|
+
recordTypeId: '012000000000000AAA' // optional
|
|
1404
|
+
})
|
|
1405
|
+
}
|
|
1406
|
+
```
|
|
1407
|
+
|
|
1408
|
+
## Parameters
|
|
1409
|
+
|
|
1410
|
+
- **`parentObjectApiName`** (String, Required) – API name of a parent object, such as `Account`.
|
|
1411
|
+
- **`recordTypeId`** (String) – ID of the parent record type.
|
|
1412
|
+
|
|
1413
|
+
## Returns
|
|
1414
|
+
|
|
1415
|
+
- **`data`** – Related List Summary Collection.
|
|
1416
|
+
- **`error`** – FetchResponse.
|
|
1417
|
+
|
|
1418
|
+
---
|
|
1419
|
+
|
|
1420
|
+
# `getObjectInfo`
|
|
1421
|
+
|
|
1422
|
+
Use this wire adapter to get metadata about a specific object, including its fields, child relationships, record types, and theme.
|
|
1423
|
+
|
|
1424
|
+
## Syntax
|
|
1425
|
+
|
|
1426
|
+
```js
|
|
1427
|
+
import { LightningElement, wire } from 'lwc';
|
|
1428
|
+
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
|
|
1429
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1430
|
+
|
|
1431
|
+
export default class Example extends LightningElement {
|
|
1432
|
+
@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
|
|
1433
|
+
propertyOrFunction;
|
|
1434
|
+
}
|
|
1435
|
+
```
|
|
1436
|
+
|
|
1437
|
+
## Parameters
|
|
1438
|
+
|
|
1439
|
+
- **`objectApiName`** (String, Required) – API name of a supported object.
|
|
1440
|
+
|
|
1441
|
+
## Returns
|
|
1442
|
+
|
|
1443
|
+
- **`data`** – Object Info.
|
|
1444
|
+
- **`error`** – FetchResponse.
|
|
1445
|
+
|
|
1446
|
+
## Usage
|
|
1447
|
+
|
|
1448
|
+
Use `getObjectInfo` for a single object. For multiple objects, use `getObjectInfos`.
|
|
1449
|
+
|
|
1450
|
+
This example retrieves record type IDs and finds the ID for the record type named "Special Account":
|
|
1451
|
+
|
|
1452
|
+
```js
|
|
1453
|
+
import { LightningElement, api, wire, track } from 'lwc';
|
|
1454
|
+
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
|
|
1455
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1456
|
+
|
|
1457
|
+
export default class RecordFormWithRecordType extends LightningElement {
|
|
1458
|
+
@api recordId;
|
|
1459
|
+
@api objectApiName;
|
|
1460
|
+
@track objectInfo;
|
|
1461
|
+
|
|
1462
|
+
@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
|
|
1463
|
+
objectInfo;
|
|
1464
|
+
|
|
1465
|
+
get recordTypeId() {
|
|
1466
|
+
const rtis = this.objectInfo.data.recordTypeInfos;
|
|
1467
|
+
return Object.keys(rtis).find((rti) => rtis[rti].name === 'Special Account');
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
```
|
|
1471
|
+
|
|
1472
|
+
---
|
|
1473
|
+
|
|
1474
|
+
# `getObjectInfos`
|
|
1475
|
+
|
|
1476
|
+
Use this wire adapter to get metadata for multiple objects, including fields, child relationships, record types, and themes.
|
|
1477
|
+
|
|
1478
|
+
## Syntax
|
|
1479
|
+
|
|
1480
|
+
```js
|
|
1481
|
+
import { LightningElement, wire } from 'lwc';
|
|
1482
|
+
import { getObjectInfos } from 'lightning/uiObjectInfoApi';
|
|
1483
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1484
|
+
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
|
|
1485
|
+
|
|
1486
|
+
export default class GetObjectInfosExample extends LightningElement {
|
|
1487
|
+
@wire(getObjectInfos, { objectApiNames: [ACCOUNT_OBJECT, OPPORTUNITY_OBJECT] })
|
|
1488
|
+
propertyOrFunction;
|
|
1489
|
+
}
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
## Parameters
|
|
1493
|
+
|
|
1494
|
+
- **`objectApiNames`** (String[], Required) – API names of supported objects.
|
|
1495
|
+
|
|
1496
|
+
## Returns
|
|
1497
|
+
|
|
1498
|
+
- **`data`** – Contains a `results` object with Object Info metadata and status codes.
|
|
1499
|
+
- **`error`** – FetchResponse.
|
|
1500
|
+
|
|
1501
|
+
### Response Structure
|
|
1502
|
+
|
|
1503
|
+
The metadata for each requested object is returned in `data.results` in the same order they were requested. If an object has an error, the error code and message are included in `data.results[].result`. The `error` object is returned only if the server call fails.
|
|
1504
|
+
|
|
1505
|
+
```json
|
|
1506
|
+
{
|
|
1507
|
+
"results": [
|
|
1508
|
+
{
|
|
1509
|
+
"result": ObjectInfo1,
|
|
1510
|
+
"statusCode": 200
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
"result": ObjectInfo2,
|
|
1514
|
+
"statusCode": 200
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
"result": [
|
|
1518
|
+
{
|
|
1519
|
+
"errorCode": "FORBIDDEN",
|
|
1520
|
+
"message": "You don't have access to this record. Ask your administrator for help or to request access."
|
|
1521
|
+
}
|
|
1522
|
+
],
|
|
1523
|
+
"statusCode": 403
|
|
1524
|
+
}
|
|
1525
|
+
]
|
|
1526
|
+
}
|
|
1527
|
+
```
|
|
1528
|
+
|
|
1529
|
+
---
|
|
1530
|
+
|
|
1531
|
+
# `getPicklistValuesByRecordType`
|
|
1532
|
+
|
|
1533
|
+
Use this wire adapter to retrieve values for all picklists of a specified record type.
|
|
1534
|
+
|
|
1535
|
+
## Syntax
|
|
1536
|
+
|
|
1537
|
+
```js
|
|
1538
|
+
import { LightningElement, wire } from 'lwc';
|
|
1539
|
+
import { getPicklistValuesByRecordType } from 'lightning/uiObjectInfoApi';
|
|
1540
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1541
|
+
|
|
1542
|
+
export default class Example extends LightningElement {
|
|
1543
|
+
@wire(getPicklistValuesByRecordType, {
|
|
1544
|
+
objectApiName: ACCOUNT_OBJECT,
|
|
1545
|
+
recordTypeId: '012000000000000AAA',
|
|
1546
|
+
})
|
|
1547
|
+
propertyOrFunction;
|
|
1548
|
+
}
|
|
1549
|
+
```
|
|
1550
|
+
|
|
1551
|
+
## Parameters
|
|
1552
|
+
|
|
1553
|
+
- **`objectApiName`** (String, Required) – API name of a supported object.
|
|
1554
|
+
- **`recordTypeId`** (String, Required) – ID of the record type. Use the Object Info `defaultRecordTypeId` property from `getObjectInfo`.
|
|
1555
|
+
|
|
1556
|
+
## Returns
|
|
1557
|
+
|
|
1558
|
+
- **`data`** – Picklist Values Collection.
|
|
1559
|
+
- **`error`** – FetchResponse.
|
|
1560
|
+
|
|
1561
|
+
---
|
|
1562
|
+
|
|
1563
|
+
# `getPicklistValues`
|
|
1564
|
+
|
|
1565
|
+
Use this wire adapter to retrieve picklist values for a specified field.
|
|
1566
|
+
|
|
1567
|
+
## Syntax
|
|
1568
|
+
|
|
1569
|
+
```js
|
|
1570
|
+
import { LightningElement, wire } from 'lwc';
|
|
1571
|
+
import { getPicklistValues } from 'lightning/uiObjectInfoApi';
|
|
1572
|
+
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
|
|
1573
|
+
|
|
1574
|
+
export default class Example extends LightningElement {
|
|
1575
|
+
@wire(getPicklistValues, { recordTypeId: '012000000000000AAA', fieldApiName: INDUSTRY_FIELD })
|
|
1576
|
+
propertyOrFunction;
|
|
1577
|
+
}
|
|
1578
|
+
```
|
|
1579
|
+
|
|
1580
|
+
## Parameters
|
|
1581
|
+
|
|
1582
|
+
- **`recordTypeId`** (String, Required) – ID of the record type. Use the Object Info `defaultRecordTypeId` property from `getObjectInfo`. If no default record type exists, the master record type is `012000000000000AAA`.
|
|
1583
|
+
- **`fieldApiName`** (String, Required) – API name of the picklist field on a supported object.
|
|
1584
|
+
|
|
1585
|
+
## Returns
|
|
1586
|
+
|
|
1587
|
+
- **`data`** – Picklist Values.
|
|
1588
|
+
- **`error`** – FetchResponse.
|
|
1589
|
+
|
|
1590
|
+
## Usage
|
|
1591
|
+
|
|
1592
|
+
Picklist values are scoped to a record type. For dependent picklists, `getPicklistValues` returns data for controlling fields and their mappings.
|
|
1593
|
+
|
|
1594
|
+
Both `recordTypeId` and `fieldApiName` are required. Use `getObjectInfo` to retrieve `defaultRecordTypeId` and pass it reactively to `getPicklistValues`.
|
|
1595
|
+
|
|
1596
|
+
This example retrieves the Rating field picklist values (`Hot`, `Warm`, `Cold`) from the Account object:
|
|
1597
|
+
|
|
1598
|
+
```js
|
|
1599
|
+
import { LightningElement, wire } from 'lwc';
|
|
1600
|
+
import { getObjectInfo, getPicklistValues } from 'lightning/uiObjectInfoApi';
|
|
1601
|
+
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
|
|
1602
|
+
import RATING_FIELD from '@salesforce/schema/Account.Rating';
|
|
1603
|
+
|
|
1604
|
+
export default class WireGetRatingPicklist extends LightningElement {
|
|
1605
|
+
accountRecordTypeId;
|
|
1606
|
+
ratings;
|
|
1607
|
+
|
|
1608
|
+
@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
|
|
1609
|
+
results({ error, data }) {
|
|
1610
|
+
if (data) {
|
|
1611
|
+
this.accountRecordTypeId = data.defaultRecordTypeId;
|
|
1612
|
+
this.error = undefined;
|
|
1613
|
+
} else {
|
|
1614
|
+
this.error = error;
|
|
1615
|
+
this.accountRecordTypeId = undefined;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
@wire(getPicklistValues, { recordTypeId: '$accountRecordTypeId', fieldApiName: RATING_FIELD })
|
|
1620
|
+
picklistResults({ error, data }) {
|
|
1621
|
+
if (data) {
|
|
1622
|
+
this.ratings = data.values;
|
|
1623
|
+
this.error = undefined;
|
|
1624
|
+
} else {
|
|
1625
|
+
this.error = error;
|
|
1626
|
+
this.ratings = undefined;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
```
|
|
1631
|
+
|
|
1632
|
+
### Example Response
|
|
1633
|
+
|
|
1634
|
+
```json
|
|
1635
|
+
[
|
|
1636
|
+
{ "attributes": null, "label": "Hot", "validFor": [], "value": "Hot" },
|
|
1637
|
+
{ "attributes": null, "label": "Warm", "validFor": [], "value": "Warm" },
|
|
1638
|
+
{ "attributes": null, "label": "Cold", "validFor": [], "value": "Cold" }
|
|
1639
|
+
]
|
|
1640
|
+
```
|