1

TL;DR

Is there way to debug the NavigationMixin? My Button fires the navigation method and nothing happens.

Hello, I'm not sure what's going wrong here. My understanding is that this setup should be sufficient. When I console log a message, I can determine that my button is activating, but the NavigationMixin is not firing the new page. The page is just a a page with a default Rich Content element that says "Thank You" there is no additional logic on that page.

HTML

<template>
    <lightning-button label="My Button" onclick={navigateToInternalPage}></lightning-button>
 </template>

JAVASCRIPT

   import { LightningElement, api, wire, track } from 'lwc';
    import getUserData from '@salesforce/apex/CommunitiesData.getUserData'; 
    import { getFieldValue } from 'lightning/uiRecordApi';
    import ID from '@salesforce/user/Id';
    import FIRST_NAME from '@salesforce/schema/User.FirstName';
    import EMAIL from '@salesforce/schema/User.Email';
    import communityBasePath from '@salesforce/community/basePath';
    import {NavigationMixin} from "lightning/navigation";
    
    
    export default class UniversalIntakeForm extends NavigationMixin(LightningElement) {
        @track error;
        @track email; 
        @api recordId = ID;
        email = EMAIL;
        firstName = FIRST_NAME; 
        user; 
    
       
        navigateToInternalPage() {
            // Use the basePath from the Summer '20 module to construct the URL
            this[NavigationMixin.Navigate]({
                type: 'comm__namedPage',
                attributes: {
                    pageName: 'testPage__c'
                }
            });
          }

1 Answer 1

2

Refer the documentation PageReference Types

navigateToInternalPage() {
    // Use the basePath from the Summer '20 module to construct the URL
    this[NavigationMixin.Navigate]({
        type: 'comm__namedPage',
        attributes: {
            name: 'Custom_Page'
      }
    });
}

name: The unique name of the Experience Builder page. The value for name is the API Name value for a supported page. The API Name field can only be defined when a new page is being created, and must be unique. If the API Name isn’t defined upon page creation, it’s automatically generated.

1
  • 1
    Just needed a second set of eyes. Didn't see the typo.
    – thinker
    Commented Oct 1, 2021 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .