Activity Forums Salesforce® Discussions How to get currentUsrId in Salesforce?

  • Shweta

    Member
    July 8, 2020 at 2:57 pm

    You can get the current user id by using UserInfo.getUserId() (which returns the user id of the current user) in your apex class.

  • Kirandeep

    Member
    July 8, 2020 at 3:12 pm

    We can get user id with use of method getUserId() of UserInfo Class

  • Marziya

    Member
    July 8, 2020 at 3:29 pm

    Apex. System.debug( 'Current User Id - '+UserInfo.getUserId());
    Visualforce. < apex:page > < h1 >Visualforce Page</ h1 > < p >UserId: {!$User.Id}</ p > < p >User Email: {!$User.Email}</ p > ...
    Aura Component. let currentUser = $A.get( "$SObjectType.CurrentUser.Id" ); Console.log(currentUser);
    Formula Fields. $User.Id.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos