Newer Version Available
force:recordEdit
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.
1<force:recordEdit aura:id="edit" recordId="a02D0000006V8Ni"/>
2<ui:button label="Save" press="{!c.save}"/>This client-side controller fires the recordSave event, which saves the record.
1save : function(component, event, helper) {
2component.find("edit").get("e.recordSave").fire();
3}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.
This component displays fields in the order they appear on the corresponding page layout and record details page. We recommend that you use this component in Lightning Experience or Salesforce1. If used outside of the one.app container, such as in Lightning Out, this component doesn't inherit the Lightning Design System styling and won't 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. |