Salesforce Decode
Salesforcedecode
Back to questions
LWCIntermediatenavigationexperiencerouting

Use lightning-navigation for consistent in-app navigation

Real World Scenario

Custom LWC uses window.location breaking Salesforce mobile app navigation and console tab behavior.

Expected Answer

• NavigationMixin Navigate with PageReference types: standard__recordPage, standard__objectPage • Generate URLs with encodeDefaultFieldValues for prefill on create • Replace window.open with NavigationMixin for internal targets • Handle navigation in Experience Cloud with community-specific page refs • Test console app workspace opening subtabs correctly • Deep link support from external systems via standard URL formats • Avoid hardcoded org URLs—use CurrentPageReference

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. NavigationMixin Navigate with PageReference types: standard__recordPage, standard__objectPage. Generate URLs with encodeDefaultFieldValues for prefill on create. Pick based on your integration pattern and team capability. NavigationMixin is platform citizenship—raw URLs break mobile and console apps. Balance speed of delivery with maintainability.

Architect Perspective

NavigationMixin is platform citizenship—raw URLs break mobile and console apps.