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
Raj01Raj01 

No such column 'lastpasswordchangedate' on entity 'User' started failing recently

Hi, 

Class started throwing below errom from yesterday. We have not updated anything  recently. 

Error : System.QueryException: No such column 'lastpasswordchangedate' on entity 'User'

Observations:
  • This class is failing only in sandbox but not in prod.
  • Sandbox Version - Summer '20 Patch 10  and Spring '20 Patch 23.21
  • If i update the class to without sharing then it is working fine.
  • The class is failing only while testing the functionlity using community user but it is perfectly working fine for internal user.
Any help will/would be appreciated?
Agustin BAgustin B
Hi,you must use without sharing for a community user to access the User object. Since you want to use with sharing in your class, you should create a separate without sharing class and method specifically to retrieve the fields on the User object.

if it helps please like and if it solves your issue mark as correct, it may help others asking the same
AnudeepAnudeep (Salesforce Developers) 

You must use without sharing in order for a community user to access the User object. Similar questions was answered here 
 

You can try logging a case with support if you believe this is a release related issue

Anudeep

Raj01Raj01
Thank you Anudeep and Agustin. 

I can do the changes but my question is, why it was working till yesteday and the same code is working in prod now but not in Sandbox. Any idea?

 
Ugur KayaUgur Kaya
Your sandbox and production environments may have different salesforce releases, also different critical updates applied possibly.
Carlos Roy Billones Jr 4Carlos Roy Billones Jr 4
What worked for me is to go in system permission in my users profile and check the manage user permission. then worked on my end.