function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vivek Pandey 102Vivek Pandey 102 

Need to get user details who login in last 90 days from current day/date

Hi Folks,
I am working on a requirement to get the users who last login was in 90 days peroid and they somehow were deactivated. So I have to activate them again through batch. I am done with batch but the query to fetch is not working. It gives records which are beyond 90 days like from 2019,2020 and 2021... That should not happen , it should give just 91 days old records-

Query I used-
SELECT Id, isActive FROM User where isActive = false and Profile.name = \'XYZ\' and LastLoginDate <= LAST_N_DAYS:90

Can anyone suggest how this query be fine tuned to get probable records for update.
SwethaSwetha (Salesforce Developers) 
HI Vivek,
Recommend reviewing https://salesforce.stackexchange.com/questions/335774/soql-to-pull-lastlogindate-from-past-2-hours-but-not-last-30-minutes