5

I have implemented the record edit according to instructions given in https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_recordEdit.htm?search_text=channel. Everything is working correctly except the recordSaveSuccess event and its handler. Below I have included my code.{!c.save} is not called. Am I doing something wrong?

/Markup/

<aura:iteration items="{!v.openActivityList}" var="activity">
    <tr onmouseenter="{!c.showEditIcon}" onmouseleave="{!c.hideEditIcon}"> 
        <td>   
            <c:DFActivityCardCmp activity="{!activity}" uiThemeDisplayed="{!v.uiThemeDisplayed}"/> 
        </td>
        <td class="vertical-align-center iconDiv">
            <div class="slds-hide"> 
                <i aura:id="editIcon" data-id="{!activity.activityId}" class="fa fa-pencil" onclick="{!c.editActivity}"></i>
            </div>
        </td>
      </tr>
</aura:iteration>

I have embedded the lightning component in Account page with a new tab.

/Handler/

<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.save}"/> 

/Controller methods/

editActivity : function(component, event, helper) {/**Opens edit popup**/
    var recordId = event.target.dataset.id; 
    var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
        "recordId": recordId
    });
    editRecordEvent.fire();
},

save : function(component, event, helper) {/**handler method**/
    console.log("record saved");
}
  • Look this link to handle recordsaveSuccess developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – vignesh Jan 24 '17 at 14:12
  • I tried this <aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.save}" /> . But its not working. – nilesh_ramteke Jan 25 '17 at 5:01
  • please,Post your full code – vignesh Jan 25 '17 at 5:24
  • @vignesh Please check edits in the question. Tell me if you need more details. – nilesh_ramteke Jan 25 '17 at 5:39
  • what if the saveRecord throws an exception? how we can handle it on this component? – danigonlinea Aug 22 '18 at 14:27
2

force:recordSaveSuccess is used with the force:recordEdit component

<force:recordEdit aura:id="edit" recordId="{!v.recordId}" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.