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
KrishnakumariKrishnakumari 

"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
User-added image
 
 
Best Answer chosen by Krishnakumari
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello Krishnakumari,

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:
User-added image

It took me a while, but I've managed to work around the problem by selecting the option in the Account field Allow reparenting:
User-added image

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

MagulanDuraipandianMagulanDuraipandian
Hi,
You are missing recordId attribute in lightning:recordEditForm.
MagulanDuraipandianMagulanDuraipandian
Check this sample code - http://www.infallibletechie.com/2018/03/lightningrecordeditform-with-lookup.html
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello Krishnakumari,

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:
User-added image

It took me a while, but I've managed to work around the problem by selecting the option in the Account field Allow reparenting:
User-added image

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.
This was selected as the best answer
KrishnakumariKrishnakumari
Many thanks Zuinglio..It worked..
vivek r 10vivek r 10
Thanks Zuinglio! I ran into this issue today and this helped resolve the issue!