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
kartheek racherla 7kartheek racherla 7 

Is Multi Insert/Delete possible with recordEditForm

Is multi insert/delete  possible with record edit form ?
Raj VakatiRaj Vakati
You would need to create three lightning:recordEditForm objects (or, just place them in an aura:iteration). Each lightning:recordEditForm creates only one record, so you'd have to submit them all separately:

Refer this link 

https://salesforce.stackexchange.com/questions/226508/multi-insert-with-recordeditform


https://salesforce.stackexchange.com/questions/226508/multi-insert-with-recordeditform/226509#226509
https://www.forcetalks.com/salesforce-topic/is-it-possible-to-bulk-insert-a-record-using-recordeditform-component-in-salesforce/

 
kartheek racherla 7kartheek racherla 7

Thanks for the reply !

I have gone through the above links and am also facing the similar issue and below is the issue for your reference 

 

<aura:component implements="force:appHostable,lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">
<aura:iteration items="1,2,3" var="iterate">
    <lightning:recordEditForm aura:id="editForm" objectApiName="Account">
        <lightning:inputField fieldName="Name"/>
    </lightning:recordEditForm>
</aura:iteration>
<lightning:button aura:id="submit" onclick="{!c.handleSubmit}" label="Save" class="slds-m-top_medium" />


--Js code--

handleSubmit: function(component, event, helper) {
    alert('submit firing');
    component.find("editForm").forEach(form => form.saveRecord(
        result => {
            // Figure out what happened
        })
                                                  );
}
Below is the error message for your reference 

[form.saveRecord is not a function] Failing descriptor: {c:AccountNewPage$controller$handleSubmit}
Raj VakatiRaj Vakati
Try this code and its wokring for me 
 
<aura:component implements="force:appHostable,lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">
    <aura:iteration items="1,2,3" var="iterate">
        <lightning:recordEditForm aura:id="editForm" objectApiName="Account">
            <lightning:inputField fieldName="Name"/>
        </lightning:recordEditForm>
    </aura:iteration>
    <lightning:button aura:id="submit" onclick="{!c.handleSubmit}" label="Save" class="slds-m-top_medium" />
</aura:component>
 
({
    handleSubmit: function(component, event, helper) {
        alert('submit firing');
        event.preventDefault();
        component.find("editForm").forEach(function(resu) {
            resu.submit(function(res){
                console.log(res);
                
            });
            //console.log(resu);
        });
    },
})

 
kartheek racherla 7kartheek racherla 7
Thanks for the code snippet , I tried but getting that account name required error , am i missing something ?
Raj VakatiRaj Vakati
Looks like you are not filling the account name into the form and submitting .. can you give me the screen shoot how you are tetsing??

Code is 100 % correct and when you enter the account name in all input fields and click save it going to create account names
kartheek racherla 7kartheek racherla 7
please find the snapshot below , after the alert popup am getting this erroerror after popup







 
Raj VakatiRaj Vakati
Dnt test from the statand alone app .. go to lighting experice and add to the record page and try 
Raj VakatiRaj Vakati
Let me  know if you see any erros form the lightning record lage not from .app
kartheek racherla 7kartheek racherla 7
I have created the record page and assigned it to the salesapp and still see the same error, is there any other thing should i do in specific with account ?
kartheek racherla 7kartheek racherla 7
for your refernece
Raj VakatiRaj Vakati
Can you do me small help .. this code is working as it for me with out any issue .. 
 
  • Can you check is there any trigger or validation 
  • Check debug logs 
  • Check browser  console 
kartheek racherla 7kartheek racherla 7
I tried to create the same code snippet in a new org too , but no luck will try again and update you asap
kartheek racherla 7kartheek racherla 7
Just to make sure am placing the component in the right way , 

I have created the lightning record page through app builder and placed the built component in it , and then made the record page to be part of the account record details page 

is the above procedure correct ?

also , thanks for all your help , so far, actually I was thinking to build a grid like component with add/remove buttons and on each add row would like to create a new record edit form
Raj VakatiRaj Vakati
Yes .. that how you have to added 
kartheek racherla 7kartheek racherla 7
Hi , Just wanted to update you regarding the code snippet , 
 
({
    handleSubmit: function(component, event, helper) {
        alert('submit firing');
        event.preventDefault();
        component.find("editForm").forEach(function(resu) {
            resu.submit(function(res){
//its not entering into this section
                console.log(res);
                
            });
        });
    },
})
the code is not coming through the submit function , and we are not able to see console.log(res) output in the console
 
kartheek racherla 7kartheek racherla 7
Just to add to the above comment , we are getting a reference error saying that resu is not defined