How to use onsuccess action in lightning:recordEditForm?

Sample Code:

Component:

<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" >
    
    <lightning:recordEditForm recordId="0036A00000QAY0CQAX" objectApiName="Contact" onsuccess="{!c.callSuccess}">
        <lightning:messages />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" />
        <lightning:inputField fieldName="Email" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update"/>                          
    </lightning:recordEditForm>
    

</aura:component>

Controller:

({
callSuccess : function(component, event, helper) {
            var params = event.getParams();
            alert(params.response.id);
}

})

Output:


2 comments:

  1. Saraswathi ChilakalaMonday, July 16, 2018

    Can you explain to get FirstName,LastName, Email field values as same id in onsuccess method of lightning:recordeditform?

    ReplyDelete
    Replies
    1. Check this - http://www.infallibletechie.com/2018/07/how-to-get-field-values-in-onsuccess.html

      Vote for this Idea - https://success.salesforce.com/ideaView?id=0873A000000lKfpQAE

      Delete