Activity Forums Salesforce Questions and Answers Profile name from LoginHistory using SOQL

  • Tanu

    September 1, 2016 at 1:59 pm

    Hii All,
    I have a requirement where i need to get the total count of Logins done by the particular profile.

  • Mohit

    September 2, 2016 at 5:34 am

    Hi Tanu,

    You can get the total count of login done by a profile by this SOQL query:-
    List<User> userid =[Select id from user where Name = 'Profile Name' limit 1];
    Integer count = [select count() from LoginHistory where id =: userid[0].id ];
    System.debug('The total count of login'+count);


Viewing 1 - 2 of 2 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos