2

Here is component I want to navigate to, named TestCmp:

<aura:component implements="lightning:isUrlAddressable" access="global">
    <aura:attribute name="someId" type="Id" />
    {!v.someId}
</aura:component>

And here is code of component, from which I want to havigate:

<lightning:navigation aura:id="navService"/>


component.find("navService").navigate({
            type: "standard__component",
            attributes: { componentName: "c:TestCmp" },
            state: { someId: "xx" }
        });

When I press the button (this code is executed) nothing happens. No error message, nothing in console. Neither in community builder nor for community user. What I also find that in this code 'finally' is never executed:

component.find("navService").generateUrl({
            type: "standard__recordPage",
            "attributes": {
                "recordId": accountId,
                "objectApiName": "Account",
                "actionName": "view"
            }
        }).finally(function(value) {
            console.log(value);
        });

If I log result of generateUrl function, it says Promise object with state 'pending'

Any ideas?

1 Answer 1

2

These navigation resources are supported only in Lightning Experience and the Salesforce mobile app. They’re not supported in other containers, such as Lightning Components for Visualforce, Lightning Out, or Communities. This is true even if you access these containers inside Lightning Experience or the Salesforce mobile app.

https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/components_navigation.htm

You must log in to answer this question.

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