Newer Version Available
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.
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}. 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 | Record save request |
| recordSaveSuccess | COMPONENT | Indicates that the record has been successfully saved. |