Courseiva
User Interface →mediumMultiple Choice

SF-PD2 User Interface Practice Question

A developer is building a Lightning Web Component that must navigate the user to a new record's detail page after a successful Apex DML operation. Which module should the developer use to perform the navigation?

⚠ Common exam trap

Candidates often confuse standard browser navigation or custom events with the platform navigation service, when NavigationMixin is the supported approach in LWC.

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 { NavigationMixin } from 'lightning/navigation';

Lightning Web Components navigate using NavigationMixin from the lightning/navigation module. After a successful DML operation, the component can use NavigationMixin.Navigate with a standard__recordPage page reference to redirect the user. Other options either reference non-existent modules, bypass the Lightning navigation framework with a full page reload, or rely on custom events that are not part of the platform navigation API.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    import { NavigationMixin } from 'lightning/navigation';

    Why this is correct

    The lightning/navigation module provides NavigationMixin, which enables Lightning Web Components to navigate to various page types such as record pages, list views, and named pages. By mixing NavigationMixin into the component class and calling this[NavigationMixin.Navigate] with the appropriate page reference, the developer can redirect the user after the DML operation completes.

  • ✗

    import { navigate } from 'lightning/platformNavigation';

    Why it's wrong here

    There is no standard Lightning Web Component module named lightning/platformNavigation that exports a navigate function. Navigation in LWC is handled through NavigationMixin from lightning/navigation. Assuming a standalone navigate import would result in a compilation error and would not perform the required redirect to the new record page.

  • ✗

    Use the window.location.assign method with a relative URL.

    Why it's wrong here

    Using window.location.assign bypasses the Lightning Experience navigation framework, causing a full page reload and potentially losing component state. It is not the recommended approach in Lightning Web Components and may not work correctly in all containers, such as the Salesforce mobile app or Lightning console. The supported method is NavigationMixin from lightning/navigation.

  • ✗

    Dispatch a custom event named 'navigate' that the parent component handles.

    Why it's wrong here

    Dispatching a custom event with the name 'navigate' is not a standard Salesforce navigation mechanism. Unless a parent component explicitly listens for and handles that event, nothing will happen. This approach relies on custom coordination and does not leverage the platform's navigation service, so it is not a reliable solution for navigating to a record page.

About these practice questions

This SF-PD2 question is part of Courseiva's 226-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.