function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mani Gunasekaran 8Mani Gunasekaran 8 

How to Access the record Id in custom lightning component on Napili

I was trying to access the record Id in custom lightning component in Salesforce Community (Napili Template) Case Record Detail page
We have done some research and found some solutions:
http://salesforce.stackexchange.com/questions/100211/how-to-access-record-id-in-custom-lightning-component-in-a-salesforce-community
https://developer.salesforce.com/blogs/developer-relations/2015/11/building-context-aware-lightning-components.html
http://salesforce.stackexchange.com/questions/93060/lightning-component-record-id-when-component-in-lightning-page?lq=1
 
I tried every single one, none of them works.
Code I tried:
<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global" >
    <ltng:require styles="/resource/SLDS102/assets/styles/salesforce-lightning-design-system-ltng.css"/>
    <aura:attribute name="recordId" type="Id"/>
    recordId: {!v.recordId}
    <div class="slds-button-group" role="group">
      <button class="slds-button slds-button--neutral">Close Case</button>
      <button class="slds-button slds-button--neutral">Reopen Case</button>
 
    </div>
</aura:component>
 
syamamotosyamamoto
Hi Mani.
I have a same problem. Please tell me how you solved this problem if you has overcomed.
syamamotosyamamoto
After all, I get it by window.location ...
E GE G
This is what I ended up doing as well, but it's just ugly. We should find why we can't obtain this recordId from the component