0

I'm trying to catch the onsuccess event of a lightning:recordEditForm , because I need the Id of the record created. I'm not able to get that Id, how can I do that?

Thank you for your help. Below you'll find my code.

Component:

 <div class="slds-m-top_small">
                <lightning:recordEditForm aura:id="createContestForm" objectApiName="Case" recordTypeId="{!v.recordTypeId}" onsuccess="{!c.onSuccess}" onerror="{!c.onError}" onsubmit="{!c.onSubmit}">
                    <lightning:messages />

                        <lightning:inputField fieldName="Scope__c" value="Penale" />
                        <lightning:inputField fieldName="Type__c"  value="Contestazione"/>
                        <lightning:inputField fieldName="Subtype__c" value="{!v.casesubtype}" />
                        <lightning:inputField fieldName="Description" />
                        <div class="slds-align_absolute-center">
                            <lightning:button aura:id="submit" variant="brand" class="slds-m-top_small" type="submit" label="Create" />
                        </div>

                </lightning:recordEditForm>
            </div>

Controller:

// Intercept the sucess event
    onSuccess  : function(component, event, helper) {
        //event.preventDefault();

        console.log('****onsuccess event****' , event);
        var params = event.getParams();
        console.log('response*****',params.response.Id);


    },

Just for clarify I see 'response***** undefined' inside the browser console.

1
  • 1
    Remember, javascript is case sensitive.
    – glls
    May 9 '18 at 13:42