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
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()];