Skip to main content
2 of 2
added 50 characters in body; edited title
Tushar Sharma
  • 29.7k
  • 7
  • 38
  • 60

"lighning:recordEditForm" Not able to create a record if master-detail relationship field is present

I am facing a strange issue. I am trying to create a record using lightning:recordEditForm but not able to create a record. I have a master detail relationship field "Account" on object "Book". When I have changed the relation to lookup it is working. But for master detail relationship it is not working. Please help me.

Below is the code

<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
     <aura:attribute name="recordId" type="Id"/>
     
    <lightning:recordEditForm  objectApiName="Book__c">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="Account__c"/>
        
        <lightning:button class="slds-m-top_small" type="submit" label="Create" />
    </lightning:recordEditForm>

</aura:component>

This is the error I am getting enter image description here