0

I have a LWC component with a link that I want to navigate directly to the Registration page in the Community. I’m using the following code to link to it.

this[NavigationMixin.Navigate]({
    type: 'comm__namedPage',
    attributes: {
        name: 'Register'
    }
});

When I click the link it sends me to an Invalid Page. The same is true if I try to link to the Forgot_Password page. If I replace the name value with another standard page's api name, it works fine. Is there something unique about these pages that prevents them from being linked to directly?

1

Are you trying to call a custom page? If not, I'm not sure if "Register" is a supported name parameter. Please check the below link:

PageReference Types

How about trying to redirect to a url, which you can buildup for you community?

this[NavigationMixin.GenerateUrl]({
      type: "standard__webPage",
      attributes: {
        url: "/communityURL/"
     },
   }).then((generatedUrl) => {
   window.open(generatedUrl);
});
3
  • it's the standard Salesforce registration page in Community builder. "Register" is the Api Name of the page. Oct 29 '20 at 17:39
  • Your solution does work. I used a non-absolute path of login/ForgotPassword. I would like to know why you can't target it like you can a standard page with the api name. Oct 29 '20 at 20:48
  • @SteveSchrab I'm not really sure, but the documentation is saying that supported pages are: Supported pages are: Home Account Management Contact Support Error Login My Account Top Articles Topic Catalog Custom pages But I'm not able to tell you exactly why Salesforce is doing so. Glad that my solution is working. :) Oct 30 '20 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.