function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Soham_MehtaSoham_Mehta 

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

I'm using $A.get('e.force:editRecord') to display standard lightning edit modal window. I want to refresh my component after user saves the given record. However there are no callback events documented by salesforce on record save success for e.force:editRecord.

By using chrome lighting inspector tool I found two events getting fired when I clicked on Save button.
1. force:recordChange (Application Event)
2. force:save (Component Event)

I declared an application event handler for force:recordChange
<aura:handler event="force:recordChange" action="{!c.handleRecordChange}"/>

Got following error
[ERROR]: No EVENT named recordChange found: Source

To handle component event force:save I have to specify event name
<aura:handler name="?" event="force:save" action="{!c.handleRecordSave}"/>

How do I notify custom component when user saves the record.
NagendraNagendra (Salesforce Developers) 
Hi Soham,

To refresh a view, run 
$A.get("e.force:refreshView").fire();,
which reloads all data for the view.May I also request you, please check with below link which might help.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_recordSaveSuccess.htm

Hope this helps.

Regards,
Nagendra.

 
Florian.GümbelFlorian.Gümbel
Hey there,

I have the same problem and I posted an idea to success platform:
https://success.salesforce.com/ideaView?id=0873A000000CQQiQAO

Feel free to vote ;)

Cheers!
Flo
Sanket VidhateSanket Vidhate
Refresh View or Reload page after $A.get('e.force:editRecord')
There is no Standard Method to refresh view or reload the component after firing $A.get('e.force:editRecord').
But I have find a trick for it . Whenever $A.get('e.force:editRecord') is fired it shows a Toast Messege. 
Add  below code in your component.
<aura:handler event="force:showToast" action="{!c.refreshAll}"/>
Add  below code in your JS controller.
refreshAll: function(component, event, helper) {
        $A.get('e.force:refreshView').fire();
    }
This will refresh the page after the standard toast messege is displayed by  $A.get('e.force:editRecord').
The solution above is tested and working good.
Hope this helps.
Regards,
Sanket Vidhate.
 
孙齐鹏孙齐鹏
@Sanket Vidhate 
give a thumb up!
much needed!!!!!Thank you.