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
hamza akouayrihamza akouayri 

How to query only user that are currently logged in org

I am trying to query only the users who are currently logged in to the org any idea? 
Best Answer chosen by hamza akouayri
VinayVinay (Salesforce Developers) 
Hi Hamza,

Use below query.
SELECT  Id, createddate, IsCurrent, UsersId, LogoutUrl, SourceIp FROM AuthSession WHERE IsCurrent = true

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.