Skip to main content

Posts

Showing posts with the label Apex.

How to get Current User Info in Salesforce

Apex: Id currentUserId = UserInfo.getUserId(); VisualForce: <p>Current User Id: {!$User.Id}</p> <p>Current User Email: {!$User.Email}</p> AuraComponent: let currentUserId = $A.get("$SObjectType.CurrentUser.Id"); LWC: import CURRENT_USER_ID from '@salesforce/user/Id'; import CURRENT_USER_NAME from '@salesforce/schema/User.Name'; import CURRENT_USER_EMAIL from '@salesforce/schema/User.Email';

Translate