4

I am just trying to get the user details on the page using LDS.

<force:recordData aura:id="userRecord"
                      recordId="{!v.userrecordId}"
                      targetRecord="{!v.record}"
                      targetFields="{!v.simpleRecord}"
                      fields="Id,
                              Name"
                      />
    <ui:outputText class="slds-output" aura:id="recordName"
                   value="{!v.simpleRecord.Name}" />

JS:

var userId = $A.get("$SObjectType.CurrentUser.Id");

In JS, I can get the current user ID, Since I get the Current User ID, is that possible to set the force:recordData recordId and print the field values?

I am trying to see if we can userinfo without apex.

6

Yes, you can:

<aura:application >
    <aura:attribute name="record" type="Object" />
    <force:recordData recordId="{!$SObjectType.CurrentUser.Id}"
                      layoutType="FULL"
                      targetFields="{!v.record}" />
    {!$SObjectType.CurrentUser.Id}: {!v.record.Name}
</aura:application>
0

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.