Do we need to cal an apex controller to get current user info. I saw this in a forum post:
var userId = $A.get("$SObjectType.CurrentUser.Id");
Console.log(userId);
but don't see the supporting documentation? Anyone know if lightning data service can be used to retrieve current user info?
1 条评论
I suspect it is still the case where Apex is required for CurrentUser.
This Trailhead walks through the current user query via apex for Lightning. Hopefully this will be updated to also include Lightning Data Services feature when it becomes available.
https://trailhead.salesforce.com/projects/workshop-lightning-programmatic/steps/programmatic-step-4