Variable Assignment in Community Builder Lightning Component

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?


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:

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

Source : Link , Question Author : Jason Benkert , Answer Author : efhard

Leave a Comment