SF-PD2 User Interface Practice Question
A developer is creating a Lightning Web Component that will be placed on a Lightning record page for the Case object. The component must display the case's subject and status. Which approach correctly retrieves the record data so the component updates automatically when the record changes?
⚠ Common exam trap
Watch out — candidates often confuse getRecordNotifyChange, which only signals that data changed, with getRecord, which actually subscribes to and returns the record data.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Import getRecord from lightning/uiRecordApi and wire it with the recordId property, then reference fields on the returned record.
The getRecord wire adapter from lightning/uiRecordApi provides a reactive subscription to a single record through Lightning Data Service. Wiring it with the recordId property means the component receives updates whenever the record changes, satisfying the automatic refresh requirement. Apex calls, form components, and notify-change utilities do not provide this reactive single-record retrieval pattern.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use the lightning-record-form base component and read its output attributes to populate the display.
Why it's wrong here
lightning-record-form is an editable form component, not a data retrieval mechanism for custom display. It does not expose the loaded record fields as output attributes for the parent to read. Using it merely to obtain field values would render an unwanted form and would not provide the subject and status in a way the custom component can present.
- ✗
Call an Apex method from connectedCallback that queries the Case by Id and assign the result to a tracked property.
Why it's wrong here
Calling Apex once in connectedCallback fetches data only at component initialization. Subsequent edits made through the UI or other components do not trigger a re-query, so the displayed subject and status become stale. Apex also bypasses Lightning Data Service caching, requiring additional code to refresh and increasing server round trips for data the platform already manages.
- ✓
Import getRecord from lightning/uiRecordApi and wire it with the recordId property, then reference fields on the returned record.
Why this is correct
The getRecord wire adapter from lightning/uiRecordApi subscribes to the Lightning Data Service record stream. When wired with @wire using the recordId, any record change made elsewhere on the page or by other components invalidates the cache and re-delivers data, so the component refreshes automatically. This is the documented pattern for displaying record fields reactively without writing Apex.
- ✗
Import getRecordNotifyChange and call it inside renderedCallback to fetch the latest field values.
Why it's wrong here
getRecordNotifyChange is used to notify Lightning Data Service that a record changed outside its knowledge, typically after a custom Apex DML. It does not fetch or return record data, so calling it in renderedCallback would not populate the subject or status. Repeatedly invoking it in renderedCallback could also create unnecessary cache invalidations.
About these practice questions
One of 226 original SF-PD2 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Salesforce exam blueprint
This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.