How to save $A.get(“e.force:editRecord”); and not go to the record page

I want to use the standard layout for creating and editing records within my lightning component.

I don’t want the user to leave the page that he is in (one page application…)

So I want to implement a popup for editing and creating these records, I am trying to use$A.get(“e.force:editRecord”):

editRecord: function(component, event, helper) {
    var recordId = component.get("v.id");

    var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
        "recordId": recordId
    });
    editRecordEvent.fire();
},

The problem that I encounter is that after the user clicks on the Save button in the popup, the page is redirected to the record that was edited or created.

I cannot find a way to cancel this redirection. This question asks how to capture the save event. Although it is related to my problem, it not the same and there is no solution there.

So can I cancel the redirection after saving?

Answer

So far it’s not possible.

If you have access to the Partner Community, I asked about this here but it was not on the roadmap for now.

An idea has been created recently for it, so I would suggest to go and vote for it here.

Attribution
Source : Link , Question Author : Itai Shmida , Answer Author : Fabien Taillon

Leave a Comment