I'm having an issue trying to save a record I'm creating using LWC.

I have a "lightning-record-edit-form component" tag with its "onsubmit" and "onsuccess". Both execute properly if I let them do their job without any extra functionality.

But, I want to fill some fields before submitting, so, I add the


statement and with

const fields = event.detail.fields;

I get the fields where I'm going to change the values. For example;

fields.Extra_data__c = 'Something';

When trying to submit this fields with


I get an exception I'm unable to catch (I'll paste the error code at the end)

enter image description here

This is not the first component where I save this way, and trying to figure what is happening I found this in hopes it may help to find a reason.

In my previous component, when I print to the console the "fields" variable, I receive the fields of the object with empty values, but in this one the field variable is an empty array. Trying to fill any fields will mantain that variable empty. Submitting this will create the mentioned error.

I've tried refreshing and resetting the fields by calling


But with no luck.

I'm completely stuck with this situation. Hope I can find some help. Thank you very much!

[NoErrorObjectAvailable] Script error.

The LWC, I've removed all the input fields but one, all them have the same behaviour;


    <lightning-record-edit-form object-api-name="Case" onsuccess={handleSuccess} onsubmit={handleSubmit}>
             <lightning-input-field field-name="TXT_Street__c" name="street" onchange={assignFieldValue} value={caseVars.street}></lightning-input-field>


     this.caseVars[event.target.name] = event.detail.value;

     const fields = event.detail.fields; // It should have case fields, but is empty
     fields.street= this.caseVars.street; 

     console.log('This is your case Id: ' + event.detail.id);

3 Answers 3


Using event.stopPropagation() instead of event.prevenDefault() works for me:

  handleSubmit(event) {

    const fields = event.detail.fields;
    fields.Custom__c = custom;
  1. This 'this.caseVars[event.target.name]' should be 'this.caseVars[event.currentTarget.name]'.

  2. Here fields.street, is street a custom field?

  3. There could also be some permission issue..!! Maybe Case object isn't accessible to your user!?


Regrettably, the only solution I have found is to recreate the LWC itself. I do not know why but after this, with the same exact code, the component worked with the expected behaviour.

I can not consider this to a proper solution, but I hope it works to anyone that encounters this same issue.

Thank you everyone.

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.