I have a remote action method which needs to update Username in User object, but it only works if I define my class as
public without sharing. If I use
public with sharing instead, updating Username will give me
"EXCEPTION_THROWN||System.DmlException: Update failed. First exception on row 0 with id 00521000000SxVkAAK; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: " error.
Any idea what's causing this? Any way that I can do it without using
public without sharing?
FYI, The method is called by a user under Customer Community Login license, & he/she is updating his/her own record, so there should not be permission issue.