Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Displaying the Create and Edit Record Modals
The force:createRecord and force:editRecord events display a create record page and edit record page in a modal based on the default custom layout type for that object.
1<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" >
2 <aura:attribute name="recordId" type="String" />
3 <lightning:button label="Edit Record" onclick="{!c.edit}"/>
4</aura:component>1edit : function(component, event, helper) {
2 var editRecordEvent = $A.get("e.force:editRecord");
3 editRecordEvent.setParams({
4 "recordId": component.get("v.recordId")
5 });
6 editRecordEvent.fire();
7}Firing this event on a record page is similar to clicking the default Edit button on a record page’s header. Records updated using the force:editRecord event are persisted automatically.