Salesforce-Platform-Developer-II Practice Test

Salesforce Spring 25 Release
202 Questions

A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property.

A. Option A

B. Option B

C. Option C

A.   Option A

Explanation:

To retrieve data from Salesforce in a Lightning Web Component (LWC), the component must use the @wire adapter with the getRecord function from lightning/uiRecordApi. This pattern is declarative and reactive, meaning the component automatically re-runs the wire adapter whenever the reactive parameters (like recordId or fields) change.

✅ Correct Answer: A.
This is the correct syntax for retrieving record data using the @wire service:

@wire(getRecord, { recordId: '$recordId', fields: '$fields' })
record;

@wire decorator wires the getRecord function to the record property.
The recordId and fields are reactive variables (note the $), meaning if their values change, the wire function re-executes.
This is the standard and recommended way to retrieve record data in LWC using the UI Record API.

❌ B.
@api(getRecord, { recordId: '$recordId' })

This syntax is invalid for two reasons:
@api is used to expose a property or method to the parent component — it cannot be used to call Apex or UI APIs.
The syntax tries to call getRecord improperly — it doesn’t use @wire and doesn’t pass required parameters correctly.

❌ C.
C is incomplete — it doesn't provide any code, so it can't retrieve data from Salesforce.

📚 Reference:
LWC Docs: Get Record Data with Lightning Data Service
getRecord adapter

✅ Final Answer:
A. Option A

Salesforce-Platform-Developer-II Practice-Test - Home Previous
Page 15 out of 202 Pages