I am trying to update records which I don't have update access on. I am expecting to get errors for such records but it updating successfully.

my org object owd is public read only and profile access is Read, create, edit, delete. and trying to update records using

Database.SaveResult[] dmlResults = Database.update(recordsToUpdate,false); but all is success in dmlResults.

From record detail page, am getting error like 'You don’t have permission to take that action on this record or related records. For help, contact your Salesforce admin.'

  • are you executing it from developer console annonymous window? Commented May 29, 2023 at 10:07
  • Am calling @AuraEnabled method from LWC component. Which is placed on home page of user. Commented May 29, 2023 at 10:09

1 Answer 1


It is expected behaviour. LWC does not respect the CRUD access. You need to explicitly handle the CRUD access check before inserting the record in Salesforce via a lightning web component.

You can use Write Simplified and Secure Apex with Spring ’23 Updates to address the user crud access check.

Database operations can specify user or system mode using the keywords as user or as system.

Account acct = new Account();
acct.Name = 'Test';
try {
    insert as user acct;
} catch (SecurityException ex) {
    // handle exception

you can also read my blog:- DO LWC RESPECT THE CRUD ACCESS IN APEX METHOD?

  • After adding dmlResults = Database.update(recordsToUpdate,false,AccessLevel.USER_MODE); its worked Thanks Sanket for your quick response. Commented May 29, 2023 at 10:33
  • @ParmanandShete, Great, You can accept the answer. Commented May 29, 2023 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .