How to check the login histories of all the users in Salesforce?

How to check the login histories of all the users in Salesforce?

To check the login histories of all the users in Salesforce, go to Setup –> Administer –> Manage Users –> Login History.

SOQL:

SELECT Id, LoginTime, UserId 
FROM LoginHistory 
WHERE LoginTime > 2021-06-23T16:05:00Z 
AND LoginTime < 2021-06-24T16:05:00Z

SOQL with User Details:

SELECT Id, Name, Username 
FROM User 
WHERE Id IN ( 
SELECT UserId 
FROM LoginHistory 
WHERE LoginTime > 2021-06-23T16:05:00Z 
AND LoginTime < 2021-06-24T16:05:00Z )

Leave a Reply