I am using Component force:recordEdit in my lightning component cmpA to show standard Record Edit page and to handle event force:recordSaveSuccess (Successful Save). Custom component cmpA is being created and destroyed when actions are completed. cmpA is assigned to a lightning Tab.

I don't need to refresh, but this is failing when I refresh page. I have to logout and login back to make this work.

Facing a strange problem with availability of aura event recordSave (Issue occurs only after Page refresh). component.find("edit").get("e.recordSave") results null (after page refresh).

Everything works fine as expected If I do not refresh browser tab. I can edit and save records multiple times without any issues until I refresh page.

Am I missing anything here during initialization or closing of my Custom Lightning component cmpA which has force:recordEdit ?

Thanks for your time.

Component cmpA

<aura:component implements="flexipage:availableForAllPageTypes, force:hasRecordId">
<aura:attribute name="recordId" access="public" type="String" description="Id of the record to be edited."/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:dependency resource="markup://force:recordSave" type="EVENT"/>
<aura:dependency resource="markup://force:recordEdit" type="COMPONENT" />
<aura:registerEvent name="saveSuccess" type="force:recordSaveSuccess"/>
<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>

<div class="cmpModal">            
    <section role="dialog" tabindex="-1" aria-labelledby="modal-content-id-2" aria-describedby="modal-content-id-2" 
        class="slds-modal slds-fade-in-open">
        <div class="slds-modal__container">
            <header class="slds-modal__header"></header>

            <div class="slds-modal__content slds-p-around_x-small">
                <div class="modal__content" id="modal-content-id-2">
                    <force:recordEdit aura:id="edit" recordId="{!v.recordId}" />

            <footer class="slds-modal__footer">
                <lightning:button variant="neutral" label="Cancel" onclick="{! c.closeModal }" />
                <lightning:button variant="neutral" label="Save" onclick="{! c.saveRecord }" />
    <div class="slds-backdrop slds-backdrop_open"></div>


saveRecord : function(component, event) {
  • Have you tried using $A.get("e.force:refreshView").fire();$A.get("e.force:refreshView").fire(); after firing component.find("edit").get("e.recordSave").fire(); Jul 4, 2017 at 14:42
  • @RishiGolyan it Didn't work, Actually it is failing to get event recordSave, so it never passes this line (firing recordSave) and fires refreshView. By the way, How firing refreshView helps here?
    – Sriram
    Jul 4, 2017 at 23:01


You must log in to answer this question.