+ Start a Discussion
notsosmartnotsosmart 

returning current user to a static User object

Hi,  I am trying to populate 'private static User mockAdminUser'  with the data of the current user.  Of the UserInfo methods I don't see anything that returns the entire object.

 

The code snippet with commented error is:

 

// Error: Compile Error: Illegal assignment from String to SOBJECT:User at line 520 column 2
mockAdminUser = UserInfo.getUserId();

 

It's obviously not the id I need anyway.  Any other approaches.

 

Thanks.

Damien_Damien_
mockAdminuser = [SELECT Name, allfieldsyouneedhere FROM User WHERE Id = :UserInfo.getUserId()];