When using Community Builder - if you add an sObject Detail page - you're able to set the design parameter as {!recordId} when you add the component to your page like this:

enter image description here

Are there any such variables for the logged in user that we can also access? I'm trying to make a dashboard and I need to pass in the ContactId of the logged in user if that's possible. I can't find anything in the docs about what's available to set in these property fields.

Another option would be to set it directly in the Lightning Component as an attribute - but again, I can't find anywhere that says this is possible. Something like:

<aura:attribute name="userId" type="Id" default="{!LoggedInUserId}"/>

Are either of these possible? Or do I have to fetch the data via apex every time?

1 Answer 1


This does work but it's not documented so not really a good idea:


The only documented way I think is to call a server side controller action: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_actions_call.htm

You'd probably want to fetch something like the UserId/ContactId once in your doInit.

  • right - the painful part is you have to use that in every controller, or you have to pass it in as a param, but either way you need to actively fetch it every time. Just kind of quirky compared to VF w/Apex controllers. I suppose the extra layers cause for extra data handling. Mar 10, 2016 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.