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}. To load record data, wire up the container component to an Apex controller that returns the data. See Working with Salesforce Records in the Lightning Components Developer Guide for more information.

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

To use this component in a standalone app, extend force:slds for the component to be styled correctly.

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.