I'm migrating some functionality from classic to lightning and need to replace javascript button which will redirect to standard edit page.

I'm using Quick Action for that calling component which does some pre-validation and then it calls e.force:editRecord.

After save is successfully performed I need to refresh record on current page as it is related and some values have been changed. Page is completely standard except for that Quick Action.

Is there a way to handle that save success as callback or any other reasonable workaround? I'm considering to create component that will show lightningEditForm instead of e.force:editRecord. It is shame that SF doesn't provide functionality to handle such situations or even handle it on its own.

  • If I weren't using Quick Action, easy fix would be adding panelOnDestroyCallback as parameter for e.force:editRecord and call $A.get("e.force:refreshView").fire(); from it. I've tried it actually, but for some reason when it is in Quick Action, that method is called only when that Quick Action is called second time. It looks that when it is within quick action, Destroy of that component is happening only before it needs to be re-rendered (initialization of QA on second call)
    – jakub
    Feb 11 '19 at 12:17

When I face this issue then, I had created a component level event and registered and fired within the component and then refreshing the value in the controller, and it worked for me.


So, solution for this issue was to implement custom component, which was using lightning:recordEditForm and use onsuccess to call this block.

setTimeout(function() {
    var response = event.getParams().response;
    var navService = component.find("navService");
    var pageReference = {
        type: 'standard__recordPage',
        attributes: {
            actionName: 'view',
            recordId: response.id
    navService.navigate(pageReference, true);
}, 250);

It will reload record and redirect to target record. Timeout is there bcs without it navigation event run first and refreshView after that, which was causing redirect back to original record page.

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.