A force:recordEdit component represents the record edit UI for the specified recordId.
This component displays fields in the order they appear on the corresponding page layout and record details page. If you want granular control over displaying of specific fields, we recommend using lightning:inputField instead.
This example displays the record edit UI and a button, which when pressed saves the record.
<force:recordEdit aura:id="edit" recordId="a02D0000006V8Ni"/> <lightning:button label="Save" onclick="{!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 onSaveSuccess event.
To use this component in a standalone app, extend force:slds for the component to be styled correctly.
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. |
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. |