2

I have 2 components that I wish to use in a lightning community.

The first component produces a list of records and if the user clicks on the name of the record i want to redirect them to another lightning component.

Here's the code I'm using to redirect and it works when not in the community

    newRedirect: function (component, event, helper) {    
    console.log('get ready to navigate');
    var navService = component.find("navService");
    var pageReference = {
        "type": "standard__component",
        "attributes": {
            "componentName": "CS_Inventory_v2"
        }, 
        "state": {}
    };

    navService.navigate(pageReference);

}

It feels like I'm missing a setting.......

2 Answers 2

3

Couple of things:

This pageReference feature is supported only in Salesforce Lightning and the Salesforce Mobile App. It does not work for components that are embedded in a flexipage.

Neither does it state supporting lightning communities.

If the component is in the same community page, you might have to add your components in a wrapper component and manage the logic in it using lightning events.

If the initial list component is on 1 page, and the other is in on another, then you will have to use lightning Navigate ToURL event to navigate between views.

0

You can also create a separate community page (may be record detail page), let's say: /inventory. From list page, make the name field as anchor tag with a param: /inventory?id=xyz

On inventory community page, pass the id of record to your component either by builder and component attributes or by reading request param in your component. Then display the required data in your component.

You must log in to answer this question.

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