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

1 Answer 1

2

force:recordSaveSuccess is used with the force:recordEdit component

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

You must log in to answer this question.

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