I have a Lightning Component that displays a lightning:dataTable of custom object records. Displayed fields include Name, Amount, and Date. I need the fields to be editable, but dataTable's inline editing feature doesn't support the date datatype. So instead, I've added a column with an edit button that calls the editPayment function.

editPayment: function(cmp)
        var editRecordEvent = $A.get("e.force:editRecord");
            "recordId": cmp.get("v.recordId")

That pops open the edit modal and everything is cool. But... after the record is edited, I need to load the edited data for my dataTable. My question: how do I know when the edit has been completed? Is there a way to setup a callback? Is the modal event in communications with the component that birthed it?

Update: actually, the Callback thing hadn't occurred to me until I got to the end of writing that post. After posting, I searched on editRecord callback and found some other threads -- looks like others have had the same issue.



Callback event on $A.get('e.force:editRecord') in lightning

It's some consolation to know I'm not alone on this, but neither of these threads had an answer...

What about... browser focus? After the modal closes, could I detect that browser focus has returned to my component?

  • 1
    Hit the same issue but couldn’t find a good solution. You could create an lightning component using <lightning:recordForm> and handle reload within it but it’s an additional component you have to maintain. Ideally salesforce should provide some navigation mechanism after editing the record.
    – Ranga
    Commented Jun 16, 2018 at 22:48

3 Answers 3


I ran into this exact problem and solved this using a listener like this:

<aura:handler event="force:showToast" action....>

While really ugly, you can successfully listen to a success toast fired from force:editRecord and parse it to see the message and type so you can refresh accordingly.

  • Yeah, but what if they cancel... I'm building my own component to do it. Seems a waste of effort, but no alternative. Commented Jun 17, 2018 at 0:22
  • But if they cancel why do you need to refresh anything? Yeah the other alternative is using lightning:recordEditForm sadly
    – tsalb
    Commented Jun 17, 2018 at 0:30
  • Good point, of course. Commented Jun 18, 2018 at 2:16
  • If you are using LDS , you can achieve the same with recordUpdated handler on force:recordData instead of relying on the message in toast event (salesforce might change the message).
    – zuke
    Commented Feb 17, 2019 at 22:34

Apparently there is no standard way to capture the save event from the standard force:editRecord Event - I think - Only way around this is to create a new custom component with your own custom save button. then force:recordSaveSuccess will work.

note - that with lightning:recordViewForm fields will get refreshed after save.

To maybe save some time to ppl here. This is what tried so far (last option seems to work but bit ugly ):

<aura:handler name="change" value="{!record}" action="{!c.doRefreshPage}"/>

// record does not change - no invoke to function

 <aura:handler event="force:editRecord" action="{!c.doRefreshPage}"/>

//Where it fires as Modal comes up

<aura:handler event="force:showToast" action="{!c.refreshAll}"/>

//Will be invoked after save - but multiple times - best option currently unfortunately - so had to hack it:

JS Controller

refreshAll: function (component, event, helper) {
        var eventType = event.getParam('type');
        var indexCall = 0; //making sure function not firing too many times
        if(eventType == 'SUCCESS'){
        if(indexCall == 0){
            indexCall +=1;
         var TreeGroup = component.find('TreeGroup'); //the aura:id of my component
         var auraMethodResult = TreeGroup.refresh();    

tsalb's and sfdx bomb solutions work, but I recommend adding additional logic to the action to fire ONLY when the right toast message is display. If not, your table will refresh any time a toast message is shown.


<aura:handler event="force:showToast" action="{!c.refreshAll}"/>


refreshAll: function(component, event, helper){
  var eventMsg = event.getParam("message").toUpperCase();
      if(eventMsg && eventMsg.includes("ACCOUNT") && eventMsg.includes("WAS SAVED")){
         //Add logic to refresh dataTable here
  • 1
    Good idea to only handle certain toasts only, but this only works in one language. You would have to work with labels and evaluate their values in the if-statement, if you have to support multiple languages.
    – Stijn
    Commented Oct 5, 2020 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .