function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vinny rvinny r 

lighting:RecordForm error message

I am getting only the below generice error message in lightning:RecordForm compoennt

An error occurred while trying to update the record. Please try again.

But I see the below error in the onerror event parameter.

"message":"An error occurred while trying to update the record. Please try again.","detail":"","output":{"errors":[],"fieldErrors":{"Name":[{"constituentField":"LastName","duplicateRecordError":null,"errorCode":"REQUIRED_FIELD_MISSING","field":"Name","fieldLabel":"Last Name","message":"Required fields are missing: [LastName]"}]}}

Also the required fields astrerik is not appearing next to the requied fields 
Raj VakatiRaj Vakati
Looks like your required field is missing .. aff the LastName field to the lighting:RecordForm and try ..
vinny rvinny r
I have the requried field in the form. I removed the value from the last name field to check whether the required field validation message was displayed properly. 
Raj VakatiRaj Vakati
Use <lightning:messages />  like below  
 
<lightning:recordEditForm
            onerror="{!c.handleError}"
            objectApiName="Contact">

            <!-- the messages component is for error messages -->
            <lightning:messages />

            <lightning:inputField fieldName="FirstName" />
            <lightning:inputField fieldName="LastName" />
            <lightning:inputField fieldName="Email" />

            <div class="slds-m-top_medium">
                <lightning:button variant="brand" type="submit" name="save" label="Save" />
            </div>
        </lightning:recordEditForm>


 
({
    handleError: function(component, event) {
        var errors = event.getParams();
        console.log("response", JSON.stringify(errors));
    }

})