Is there's a field showing the last login of an em...
# suiteql
s
Is there's a field showing the last login of an employee ?
m
You can search
LoginAudit
table
s
Yes. That's where the info is but there's millions of records. I want to look at a user and see the last login date
j
probably need to do a where clause and only look at the last <x> days and then just get the max
that’s how we do it….
s
Good. We have over 33 millions records Just look at today, takes forever. Clearly there is not index on that custom record
j
jeebus. We’ve had our NS account since 2007 and we only have 500k
but our customers don’t log in (usually)
s
Thanks. It's pretty strange that Netsuite are not saving the last date on the user and/or customer Just make our life difficult
j
agreed
you might be able to request they put an index on that table for you
r
Are you not able to do it, even if you create a search on the login audit trail, with criteria Email of the user, logged in within the last 30 days, where login was a success and get the max date.
s
I can, no problem. The issue now is the number of records (33 millions). I found a work around. I start reading the loginaudit by the end and stop when date is different than today. It work faster
j
wait, what’s your actual problem? You just want to know people that didn’t log in today?
m
We have 23 million rows in that table
This query takes < 2 secs
Copy code
SELECT
  MAX(LoginAudit.Date)
FROM
  LoginAudit
WHERE
  LoginAudit.User = ?
  AND LoginAudit.Status = 'Success'
GROUP BY LoginAudit.User