1

I am trying to redirect on the a href click to a custom visualforce page in lightning.

<a href=# onclick={navigateto###} target="_blank"></a>


 navigateto###() {
        console.log('Inside navigate to home Tab');
        // Navigate to the Account home page
        this[NavigationMixin.Navigate]({
          type: 'comm__namedPage',
          attributes: {
           pageName: 'FileVie###',
          },
          state: {
           'fileId': '0685D00#####'
          }
         });
    }

But as standard way its apeending s to it. https://abc.force.com/s/FileVie###?fileId=0685D00#####

Is there any chances to remove s or any other way to redirect to a custom visualforce page with redirect. I have also used , custom URL however it is appending the url on the same community page not in a separate tab:

this[NavigationMixin.Navigate]({
        type: 'comm__namedPage',
        attributes: {
            pageName: 'https://wwww.salesforce.com'
        }
3
  1. In communities, only comm__namedPage page-reference will work.

  2. It will navigate to specified community page within community.

  3. You have to use component/page inside community page.

  4. Although you can pass the parameters through state, you cannot get the state from component as it is inside community page.

  5. If you want to get the data exchange, you can use browser storage like localStorage or sessionStorage.

Finally, what you are trying to do is not possible as of now. Instead, try implementing with work-around like above.

|improve this answer|||||
  • For #3 you say "you can pass the parameters through state" but the documentation says "Lightning communities don't support the state property" for PageReference. Do you have state working in a NavigationMixIn for comm__NamedPage? – David Cheng Mar 20 at 16:39
  • @DavidCheng, If you read it fully, I was saying you can pass the parameters BUT you can never read them – salesforce-sas Mar 30 at 2:20

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.