force:recordEdit

Generates an editable view of the specified Salesforce record.

A force:recordEdit component represents the record edit UI for the specified recordId. This example displays the record edit UI and a button, which when pressed saves the record.

<force:recordEdit aura:id="edit" recordId="a02D0000006V8Ni"/>
<ui:button label="Save" press="{!c.save}"/>

This client-side controller fires the recordSave event, which saves the record.

save : function(component, event, helper) {
component.find("edit").get("e.recordSave").fire();
}

You can provide a dynamic ID for the recordId attribute using the format {!v.myObject.recordId}. Make sure you have wired up the container component to an Apex controller that returns the object data using the @AuraEnabled syntax.

To indicate that the record has been successfully saved, handle the force:recordSaveSuccess event.

Attributes

Attribute Name Attribute Type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
recordId String The Id of the record to load, optional if record attribute is specified.

Events

Event Name Event Type Description
recordSave COMPONENT User fired event to indicate request to save the record.
onSaveSuccess COMPONENT Fired when record saving was successful.