0

I'm working on a case entry form using lightning component for partner community site (Napili template).

Form is working OK, I can create cases. However I'd like to navigate the user to case detail page after creating the case.

I tried using $A.get("e.force:navigateToURL") but it doesn't work; this function seems specific to Salesfore1.

Can someone please let me know how to navigate to record detail page in lightning component for community?

1 Answer 1

3

The beauty of component framework is events .You can make two components talk to each other via events .All you need to do is handle the event when the case record is created in another component and use Navigation to redirect to needed page

Here is sample component you need to create for that

Create a component like below

<aura:component implements="forceCommunity:availableForAllPageTypes">
  <aura:handler event="force:navigateToSObject" action="{!c.navigate}"/>
</aura:component>

The handler controller logic for same is as below

({
 navigate: function(component, event, helper) {
  var sobjectId = event.getParam("recordId");
    console.log(sobjectId);
    if (sobjectId.indexOf("500") >-1) { //Note 500 is prefix for Case Record
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": '/case/'+sobjectId,
            "isredirect" :false
        });
        urlEvent.fire();
    }
  }
})

Drag this component on the case creation screen using community builder .

0

You must log in to answer this question.

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