Courseiva
User Interface →mediumMultiple Choice

SF-PD2 User Interface Practice Question

A developer is creating a Lightning Web Component to display a list of high-priority Opportunities. The component needs to reactively update whenever an Opportunity is updated elsewhere on the page by another component. Which approach is most efficient and requires the least amount of custom code?

⚠ Common exam trap

Candidates often suggest using custom events or platform events to synchronize data between components, failing to realize that LDS wire adapters provide this reactivity automatically without any code.

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

✓

Use the getRecord wire adapter to retrieve Opportunity data.

Lightning Data Service (LDS) provides a managed cache that is shared across all components in a Lightning page. When a record is updated via LDS in one component, all other components wired to that same record or using LDS wire adapters automatically receive the updated data. This eliminates the need for manual event handling or complex state management.

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 getRecord wire adapter to retrieve Opportunity data.

    Why this is correct

    The getRecord wire adapter is built on Lightning Data Service, which maintains a client-side cache. If any other component updates the Opportunity record using LDS, the wire service automatically triggers a refresh for all components observing that record, ensuring data consistency across the UI without requiring custom refresh logic.

  • ✗

    Implement an Apex controller with a @AuraEnabled(cacheable=true) method.

    Why it's wrong here

    While cacheable Apex methods provide performance benefits, they do not automatically refresh when the underlying database record changes. The developer would need to manually call refreshApex(), which introduces additional complexity and code compared to the automatic synchronization provided by the native Lightning Data Service wire adapters.

  • ✗

    Publish a message via Lightning Message Service (LMS) after every update.

    Why it's wrong here

    Using LMS requires significant boilerplate code, including defining message channels and implementing publishers and subscribers in every relevant component. While powerful for cross-framework communication, it is an over-engineered solution for simple record data synchronization that is already handled natively by Lightning Data Service.

  • ✗

    Set up a Change Data Capture (CDC) listener in the component.

    Why it's wrong here

    CDC is a server-side feature that pushes notifications to the client via CometD. Implementing a Streaming API client in LWC is complex and typically reserved for external system integrations or high-latency updates. For UI-level reactivity within a single session, LDS is the standard and most efficient mechanism.

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 →

How Courseiva writes practice questions · Editorial policy

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.