Skip to main content

I have a SOQL Query that allows me to obtain information about the object (LoginHistory), but it returns all the logins that a user has had in the day, I only need to obtain the logins that have been made at the current time in which the consultation is made. 

How to resolve this topic, since at all times it returns the total of connections of the day ?

This is my Query

SELECT UserId, COUNT(Id), Max(LoginTime)

FROM LoginHistory

WHERE UserId IN ('0053C000002kNZJQA2','0053C000002jCirQAE')

AND LoginTime >= 2021-06-03T10:00:00.000Z

GROUP BY UserId

Aditional i don't know wite Saleforce don't accept a condition "Beetwen", because don't show all data.

Example:

SELECT UserId, COUNT(Id), Max(LoginTime)

FROM LoginHistory

WHERE UserId IN IN ('0053C000002kNZJQA2','0053C000002jCirQAE')

AND LoginTime = TODAY

AND LoginTime >= 2021-06-03T08:00:00.000Z

AND LoginTime <= 2021-06-03T12:59:59.000Z

GROUP BY UserId

 

 

 
1 Antwort
  1. 3. Juni 2021, 17:46
    In your query you are are specifying login time-:

     

    2021-06-03T10:00:00.000Z

     

     Add time to login time and then query.

     

     The 00 at then end indicate time
0/9000