0

I'm using below code to redirect to a lightning component.

          component.find("navService").navigate({
                "type": "standard__component",
                "attributes": {
                    "componentName": "c__CustomComponent"    
                },    
                "state": {
                    "c__myAttr": "attrValue"    
                }
            });

I have created a tab for that component also. But still getting error "This page isn't available in Salesforce Lightning Experience or mobile app."

It is showing URL as : https://mydomain-dev-ed.lightning.force.com/lightning/cmp/c__CustomComponent?c__myAttr=attrValue

3
  • 1
    Is the other component, where you want to redirect, implementing the correct interface : implements="lightning:isUrlAddressable" ? refer to the documention for more details
    – Shamina
    Commented Oct 3, 2020 at 17:35
  • I added it now, it is working. Thank you.
    – Manoj
    Commented Oct 3, 2020 at 17:39
  • Great. posted an answer, mark it as accepted :)
    – Shamina
    Commented Oct 3, 2020 at 17:51

1 Answer 1

0

The target component must implement the lightning:isUrlAddressable interface to enable direct navigation via URL.

<aura:component implements="lightning:isUrlAddressable" description="target component">
    <aura:attribute name="myAttr" type="String" />
    <!-- additional code here -->
</aura:component>

More details from documentation

3
  • How to handle above issue in LWC.? Is there any replacement for "lightning:isUrlAddressable" in LWC? @Shamina
    – Manoj
    Commented Aug 30, 2021 at 11:55
  • @manoj If not already done, I suggest to post a new question for your query about LWC
    – Shamina
    Commented Sep 2, 2021 at 14:53
  • 1
    @manoj - unfortunately, no, you cannot directly navigate to an LWC component. The standard workaround is to simply create a wrapper Aura component that contains the LWC, and then navigate to that Aura wrapper.
    – jbyrd
    Commented Sep 23, 2021 at 15:49

You must log in to answer this question.

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