I need to have a custom view for Account details. So I created one component which implements both interfaces hasrecordid and pageforalltypes.

I created one variable x in my controller.js so that I could store the recordid at run time and pass it to my @AuraEnabled apex class for further processing. For testing purposes I hard coded x with some Account Id and everything worked as expected when I ran it in one of my test app.


Before moving this working component to my community I cleared x and made it equal to cmp.get("v.recordid");:


I didn't define any attribute as recordid in cmp as I believed it would take the same from URL at run time.

I added the above component in the Account detail page using community builder. Then I opened one of the Account records however this time no Account related data came up.

I added console.log and it showed undefined. I added {!recordId} in the component(cmp) however nothing showed up on page load (blank).

So is there anyway I could get this accountid at run time?

2 Answers 2


Assuming your code in the post is exactly as you tried it, your problem may have been case sensitivity. The correct value is recordId, not recordid.

I have confirmed that this does work. I've written up a brief demonstration that shows how it works.

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="output" type="String" />
    <ui:button label="Reveal" press="{!c.reveal}" />

    reveal: function(component, event, helper) {
        component.set("v.output", component.get("v.recordId"));

Without seeing your code, it's hard to tell what you've done differently, but this does work in my community, which I tested:

Demo Napili Community Record


comp1 and com`p2 inside lightning tabsets were not taking the recordid. Then i tested after removing tabset component and having just individual components (comp1 and comp2)


in my aura component and it used the recordid.

So I Copied the entire code inside comp1 and comp2 and pasted it inside the ltngtabs and this time everything processed successfully.

<ltngtabset> <ltngtab> all the code earlier in comp1 </ltngtab> <ltngtab> all the code earlier in comp2 </ltngtab> </ltngtabset>

Though this worked I do not know the reasons for the same.

@sfdcfox thanks a lot for looking into this

You must log in to answer this question.

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