Share X / Twitter LinkedIn

I was having issue with NavigationMixin(LightningElement) while working in Salesforce Experience cloud (sites), I was unable to navigate from one site page to another using code. Working snippet of navigating from one site page to other (community and site page example)

Initial Code looks like this :

let authenticatedUser = await this.callAuthenticationOrAnyother();if (!authenticatedUser) {
this[NavigationMixin.Navigate]({
type: "comm__namedPage",
attributes: {
name: "Sample1__c"
}
});
}

What are the things I was missing and how I fixed -

  • Make sure the api name of the site page is exactly same (it’s a case sensitive and make sure you are appending __c in the end of the name just like mentioned above) image image_site_navigation

If you are working on Salesforce Experience Cloud customisation and need to bring in external libraries, you might find Using Dynamic JavaScript Imports in Salesforce LWC with Light DOM useful as well.

Work with us

Have a similar challenge?

Tell us about your integration or data problem — we'll scope it and respond within one business day.