SOQL to find whether users have logged in to the Sandbox

SOQL to find whether users have logged in to the Sandbox

SOQL on the Login History object/entity can be used to find whether users have logged in to the Sandbox.

Sample SOQL:

SELECT Id, LoginTime, UserId 
FROM LoginHistory 
WHERE DAY_ONLY( LoginTime ) = LAST_N_DAYS:31 
AND UserId != 'YOUR USER ID' 
ORDER BY LoginTime DESC LIMIT 100

I have checked whether any of the users have logged in for the past 31 days in the query.

Leave a Reply