<aura:component implements="force:appHostable">
<aura:attribute name="recordId" type="String" />
<lightning:card title="Create Reservation">
<lightning:recordEditForm
onsuccess="{!c.handleSuccess}"
objectApiName="Campsite_Reservation__c">
<!-- the messages component is for error messages -->
<lightning:messages />
<lightning:inputField fieldName="Campsite__c" value="a041o00000ZWoFbAAL"/>
<lightning:inputField fieldName="Reference__c"/>
<div class="slds-m-top_medium">
<lightning:button variant="brand" type="submit" name="save" label="Save" />
</div>
</lightning:recordEditForm>
</lightning:card>
({
handleSuccess: function(cmp, event, helper) {
var params = event.getParams();
cmp.set('v.recordId', params.response.id);
}
})
I'm setting the Id of the master record as the value
on the new child record which should get created. When the save button is clicked, an error message is displayed as per the screenshot. Is this a known limitation?
Best Answer
This is a weird issue even if in the logs the error message is not clear. The log just says REQUIRED_FIELD_MISSING.
There is a workaround available to solve this issue. You have to set the Reparentable Master Detail to true for Campsite__c and it should work.