Usage of force:recordEdit

Editing the record on lightning experience easy with the force:recordEdit component which represents the record edit UI for the specified recordId. force:recordEdit component displays fields in the order they appear on the corresponding page layout and record details page.  Below is the simple way to use the force:recordEdit which display the edit page and saves button will save the data.

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

Here is the simple component that we will use to edit the contact record

component 

controller.js

 

Code walkthrough 

  • Create a force:recordEdit component with aura:id and recordId and used controller handler for onSaveSuccess to show the save notification.

  • The below controller handler will invoke on the save button click. The force:recordSave event will be fire on saving

  • handleSaveSuccess handler will be invoked after the record is saved and shows the toast notification to the user

     

Create a quick action as shown below and add this action to page layout.

After you click the Edit Contact you can see the model open in edit mode