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
SaifSaif 

How to write Soql query on user not login in instance?

Hi 
Please help me i want to fetch the details user who doesn't login in the instance (environment) since last 2 weeks.how to write the soql to fetch this information.

Thanks,
Saif.
SFDC New learnerSFDC New learner
Hi,

try this.
select id,LastLoginDate,username from user where LastLoginDate > LAST_N_DAYS:15

 
SaifSaif
Hi,
Thanks for the reply but this query will give me who has login last 15days. i need that users who dont login since last 15days.

Thanks,
Saif
SFDC New learnerSFDC New learner
Hi Saif,

try changing greater than symbol to less than.
select id,LastLoginDate,username from user where LastLoginDate < LAST_N_DAYS:15

I checked this link
https://success.salesforce.com/answers?id=90630000000hgQfAAI

Thanks,
Sirisha
SaifSaif
Hi Sirisha,
Thanks for the reply can you please explain what would be the Result for query 
select id,LastLoginDate,username from user where LastLoginDate > LAST_N_DAYS:15?

Regards,
Saif.
SaifSaif
Hi Sirisha,
 I am thinking that this query (select id, LastLoginDate, username from user where LastLoginDate > LAST_N_DAYS:15?)will fetch the users who are lastlogin . But my question is users who don't login in the instance I need to fetch those users.

Regards,
Saif.