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{
      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) => {
      .catch((error) => {

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.