ExamGecko
Question list
Search
Search

Question 133 - Certified B2B Commerce Developer discussion

Report
Export

A developer is on a tight timeline and needs to implement a Lightning web component which can read, create and modify single records. What is the recommended path forward?

A.
Use base components
Answers
A.
Use base components
B.
Write custom functions against a wire adapter
Answers
B.
Write custom functions against a wire adapter
C.
Create an Apex Controller
Answers
C.
Create an Apex Controller
D.
Use Lightning Data Service
Answers
D.
Use Lightning Data Service
Suggested answer: D

Explanation:

To implement a Lightning web component which can read, create and modify single records, the recommended path forward is to use Lightning Data Service. Lightning Data Service is a service that provides access to Salesforce data and metadata, cache management, and data synchronization across components. Lightning Data Service allows developers to use standard components or base components to perform CRUD (create, read, update, delete) operations on single records without writing Apex code or SOQL queries. Lightning Data Service also handles data caching, performance optimization, and conflict resolution automatically. Using base components is not a sufficient way to implement a Lightning web component which can read, create and modify single records, as base components are only user interface elements that do not provide data access or manipulation functionality by themselves. Base components need to be used with Lightning Data Service or other services to perform CRUD operations on single records. Writing custom functions against a wire adapter is not a recommended way to implement a Lightning web component which can read, create and modify single records, as it involves writing complex and error-prone JavaScript code that may not be efficient or scalable. Writing custom functions against a wire adapter also requires handling data caching, performance optimization, and conflict resolution manually. Creating an Apex controller is not a recommended way either, as it involves writing Apex code that may not be necessary or optimal for performing CRUD operations on single records. Creating an Apex controller also requires exposing Apex methods using @AuraEnabled or @RemoteAction annotations and invoking them from JavaScript code using imperative calls or promises. Salesforce

Reference:Lightning Web Components Developer Guide: Access Salesforce Data,Lightning Web Components Developer Guide: Base Components, [Lightning Web Components Developer Guide: Call Apex Methods]

asked 23/09/2024
Darin Ambrose
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first