[SalesForce] Standard cancel button in lightning:recordform not closing the quick action dialogue

I am creating a lightning component which shows opportunity in edit mode using lightning:recordform tag(summer 18 salesforce release). Now when I am clicking on cancel button it should close the quick action dialogue but it is displaying the same record in view mode on same quick action dialogue.

Edit form using lightning:recordform

After clicking cancel button on screen

code sample :

<lightning:recordForm 
     recordId="{!v.recordId}" 
     objectApiName="Opportunity" 
     layoutType="Full" 
     columns="2"
     mode="edit"
     onsubmit="{!c.handleSubmit}"/>

Best Answer

You need to add "oncancel" as an attribute:

<lightning:recordForm 
 recordId="{!v.recordId}" 
 objectApiName="Opportunity" 
 layoutType="Full" 
 columns="2"
 mode="edit"
 onsubmit="{!c.handleSubmit}"
 oncancel="{!c.handleCancel}"/>

For some reason it is not in their documentation which can be found here but it works for me!

Hopefully this solves your issue.

Related Topic