+ Start a Discussion

Navigate to record detail page from the lightning community builder

I want to redirect the record to its detail page when onclick from the component. 
<a href="{!'/'+resultWrap.resultId}" class="slds-card__header-link slds-truncate"  >
        <span class="slds-text-heading_small" style="{!'color:'+v.textColor}">

 so I specified the ID in href.
It works fine in lightning component, but in the Community builder when I click the record am getting an error message (invalid page)
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi, Dinesh,

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");
    if (sobjectId.indexOf("500") >-1) { //Note 500 is prefix for Case Record
        var urlEvent = $A.get("e.force:navigateToURL");
            "url": '/case/'+sobjectId,
            "isredirect" :false

Please refer the below link for reference. Hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Rahul Kumar