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
Science LogicScience Logic 

count logged-in users

I need to use SOQL or the API to get a count of users that are currently logged in. How can I do this?
Shri RajShri Raj
Select l.UserId, l.Status, l.SourceIp, l.Platform, l.LoginUrl, l.LoginType, l.LoginTime, l.Id, l.ClientVersion, l.Browser, l.Application, l.ApiVersion, l.ApiType From LoginHistory l

Give a try pasting this in Eclipse. Remove duplicates. Should give you the number of users who have logged in today . But not who are actively logged in currenty
Deepak Kumar ShyoranDeepak Kumar Shyoran
Use LoginHistory object to get the information of currently logged n user in your org.

Visit this https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_loginhistory.htm for more detail in LoginHistory