Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is sort of available via the user interface, and sort of available via API calls (after v21), and sort of available via reports - but I want to actually query the object directly and drive functionality based on that. Is there any way to do this?

If not, how can I most effectively create and populate a parallel object that allows me to drive this functionality?


share|improve this question
up vote 7 down vote accepted

you have to query LoginHistory object. I just tried to execute this from 'Developer Console' and works nicely

system.debug([SELECT ApiType,ApiVersion,Application,Browser,ClientVersion,Id,LoginTime,LoginType,LoginUrl,Platform,SourceIp,Status,UserId FROM LoginHistory limit 12]);
share|improve this answer
Thanks! For some reason, querying LoginHistory wasn't working from the Explorer ... – John Westenhaver Dec 27 '12 at 4:18
I just tried to execute this from 'Developer Console' and works nicely – Prafulla Patil Dec 27 '12 at 4:38
You would need to be using API version 21.0 or higher to access the LoginHistory records as it was introduced in the Spring '11 release. – Daniel Ballinger Dec 27 '12 at 6:44

Go through Login History Object

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.