I am using lightning:recordEditForm to generate a form for cloning opportunity record.

currently, there is no functionality to clone a record using lightning:recordEditForm.

So what Approach I am using to use the recordEditForm to show all the record values and before submit, I will collect all the field values and create a new Opportunity with Products.

<aura:attribute name="sectionFields" type="Object[]"  />
<aura:attribute name="sectionHeader" type="String"  />

<lightning:recordEditForm aura:id="test"
                              objectApiName="{! v.sObjectName }"
                              recordId="{! v.recordId }"
                              recordTypeId="{! v.recordTypeId }"
        <lightning:messages />

    <div class="slds-page-header__col-details">
        <h3 class="slds-section-title--divider" style="color:rgba(60, 74, 164, 1.0);font-weight:bold;">{!v.sectionHeader}</h3>
        <lightning:layout multipleRows="true">
            <aura:iteration items="{! v.sectionFields }" var="field">
                <lightning:layoutItem size="12" smallDeviceSize="12" mediumDeviceSize="12" largeDeviceSize="12" padding="around-small">
                    <div class="custom-box">
                        <lightning:inputField fieldName="{! field.APIName }" class="slds-p-top_small slds-m-top_medium" />
   <lightning:button variant="brand" type="submit" label="Save" title="Save"  />

Here sectionFields is list of opportunity fields which is coming from fieldset that I created.

And I am using this functionality to modify all the values that user wants to change. And when user click on submit button it will call onSubmitAction method

I am using below approaches to fetch the field data but no success.

onSubmitAction: function(component, event, helper){
        var eventFields = event.getParam("fields");
        console.log('-------LeadSource-----',eventFields["LeadSource"] );

        var objJSON = JSON.parse(JSON.stringify(eventFields));
        var recUi = event.getParam("recordUi");

Any suggestion or solutions.

Also, I found that currently it is in ideaExchange https://success.salesforce.com/ideaView?id=0873A000000lKfpQAE but saw few comments about the workaround

enter image description here

  • The Proxy object is still a real object. Your data should be in there? – sfdcfox Jan 10 at 15:09
  • yes @sfdcfox but when I tried, the data is not available for me in submit method. – Ratan Paul Jan 10 at 15:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.