0

How does with and without sharing work in regards to Community users and DML in LWC Apex controllers. Testing without sharing on a community user that does not have CRUD access on the object throws an internal server error. Does with or without sharing not have any effect on DML in LWC controllers for Community users?

Apex class

public without sharing class myClass{
    
     @AuraEnabled
      public static void myMethod(Application__c application) {
        try {
          insert application;
        } catch (Exception e) {
          throw new AuraHandledException(e.getMessage());
        }
      }
    
    }

LWC method

handleSubmit() {
  processApplication({ application: this.application})
      .then((response) => {
        console.log(response);
      })
      .catch((error) => {
        console.log(error);
      });
  }
2
  • Can you check if inherited sharing has any different behavior? Commented May 3, 2021 at 15:31
  • Inherited sharing does not help in this situation.
    – Jordan
    Commented May 5, 2021 at 8:52

1 Answer 1

0

Internal Server Errors are notoriously difficult to troubleshoot. I would suggest submitting a support case with the ISE # to get more detail on what the root cause is.

You must log in to answer this question.

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