ForceChallenges
ProblemsDailyNotesInterview
Sign in

Practice

All problemsSOQL practiceApex trigger challengesDaily challengeOpportunityTrigger.oldMapBefore UpdateBulkificationContactValidationGROUP BYSemi-JoinAccountBefore Insert

Interview questions

All questionsAdminAdministrationApexApex TriggerAsync ApexDevelopmentField ServiceField ServiceIntegrationLwc

By company

DeloitteSalesforceAccentureInfosysPwCCognizant

Learn

Study notes

ForceChallenges

AboutContact usPrivacy PolicyTerms of ServiceFor AI assistants (llms.txt)
© 2026 ForceChallenges · Salesforce SOQL & Apex trigger practice
Development questions7 of 102
DevelopmentEasy 1 min read

How do you navigate to a record page or another page from an LWC?

Answer

Use NavigationMixin from lightning/navigation:

javascript
import { NavigationMixin } from 'lightning/navigation';

export default class Nav extends NavigationMixin(LightningElement) {
  goToRecord() {
    this[NavigationMixin.Navigate]({
      type: 'standard__recordPage',
      attributes: { recordId: this.recordId, actionName: 'view' }
    });
  }
}

Common type values: standard__recordPage, standard__objectPage, standard__webPage, standard__navItemPage, comm__namedPage (Experience Cloud). Use GenerateUrl to get a URL instead of navigating.

lwcnavigation
Practice SOQL & Apex
PreviousHow do you show a toast message in LWC?Next What is Shadow DOM in LWC and how do you query elements inside a component?

More Development questions

  • What is reactivity in LWC and when does a field trigger a re-render?
  • What are the best practices to improve LWC performance?
  • How do you unit test an LWC with Jest?
  • How do you use a third-party JavaScript library or static resource in LWC?
  • Why can renderedCallback run multiple times and how do you prevent repeated execution?