+ Start a Discussion

User login history



Is there an option to query user login history in Apex? If so can someone please provide an example or any documentation?





You can [SELECT LastLoginDate FROM User].


The only way I could imagine you being able to get a longer history is to have field tracking enabled on that field, which I am pretty sure isn't possible.

Rakesh BoddepalliRakesh Boddepalli

Yes You can, 

You can fire the SOQL query on the Loginhistory table.

check this link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_loginhistory.htm for further information .

Actually "Login History" is an Object in Salesforce..
So get into the workbench or data loader, select that perticular Object and select the fields what are required for you requirement.