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.
<aura:App>
<c:comp/>
</aura:App>
Before moving this working component to my community I cleared x
and made it equal to cmp.get("v.recordid");
:
x=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?