function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OnDem DevOnDem Dev 

How can we find who is the logged in User?

Hi,

 

Can we find whether the logged in user is the actual User or the Admin who can log in after providing Grant Login Access?

 

Regards,

OnDem

rocwilcoxrocwilcox

The "UserInfo" object has many methods. 

Such as: 

Userinfo.getUserId()  and Userinfo.getUserName()

 

 

OnDem DevOnDem Dev

Thanks for the answer.

 

But i want to know if the Admin logs in as a particular User, then how can that be figured out i.e. Admin has logged in or the Actual User has logged in.

sfdcfoxsfdcfox
Unfortunately, there's no way to determine if it's a "sudo" login (as *NIX folk would say), or if the user is actually logged in. When you are "granted login access", you are literally logged in as that person. Might I ask what the use case for this might be? I'm sure the Force.com developers would be interested in knowing this for a future upgrade to the platform.
adityaMorganadityaMorgan
hi,
You found answer of this? how can we know if the Admin logs in as a particular User, then how can that be figured out i.e. Admin has logged in or the Actual User has logged in??