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
KiranNaiduKiranNaidu 

For Community Site I have custom VF login page, where i give valid user name and Password, page controller class is a sharing where we I have SOQL Query on User Object to Query on the UserName, but Query result is zero in the Debug Logs

If I run the same query in the developer console, it is giving the result with username. for Gust profile also I shared this Class.

Can somebody help me what is that i am missing.

Need urgent help.
Best Answer chosen by KiranNaidu
AnudeepAnudeep (Salesforce Developers) 
What does UserInfo.getUserId() return in guest user context? 

Also, what is the result of the following query?
 
SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel
     FROM UserRecordAccess
     WHERE UserId = [single ID].  //guest user id
     AND RecordId = [single ID]      //user object record where the query is running on

All Answers

AnudeepAnudeep (Salesforce Developers) 
What does UserInfo.getUserId() return in guest user context? 

Also, what is the result of the following query?
 
SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel
     FROM UserRecordAccess
     WHERE UserId = [single ID].  //guest user id
     AND RecordId = [single ID]      //user object record where the query is running on
This was selected as the best answer
KiranNaiduKiranNaidu
Thank you Anudeep. This helped me to debug.