You need to sign in to do that
Don't have an account?
Krishnakumari
"lighnting:recordEditForm" Not able to create a record if master-detail relationship field is present
Hi,
I am facing a strange issue.
I am trying to create a record using lightning:frecordEditForm but not able to create a record.
I have a master detail relationship field "Account" on object "Book". When I have change 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
I am facing a strange issue.
I am trying to create a record using lightning:frecordEditForm but not able to create a record.
I have a master detail relationship field "Account" on object "Book". When I have change 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
I was able to reproduce the issue you're facing and find a workaround. I did some digging and found a really strange message, behind the scenes, saying that the Account__c field wasn't informed, plus a Stacktrace not very helpful. It must be a bug in the component!
The message says that the Account field wasn't informed:
It took me a while, but I've managed to work around the problem by selecting the option in the Account field Allow reparenting:
I've also had to refresh the page and make sure the cache was cleared, in order to get it working.
I couldn't find any known issue about this, and I will probably open a case to get more information about it.
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
You are missing recordId attribute in lightning:recordEditForm.
I was able to reproduce the issue you're facing and find a workaround. I did some digging and found a really strange message, behind the scenes, saying that the Account__c field wasn't informed, plus a Stacktrace not very helpful. It must be a bug in the component!
The message says that the Account field wasn't informed:
It took me a while, but I've managed to work around the problem by selecting the option in the Account field Allow reparenting:
I've also had to refresh the page and make sure the cache was cleared, in order to get it working.
I couldn't find any known issue about this, and I will probably open a case to get more information about it.
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.