1

Are there a way to add callback after the user created a record and clicked the Save button?

I am using a custom tab and custom components and open the Create a record modal window using e.force:createRecord, but I was not able to find out how to attach callback to the event.

I even found this:

Currently force:createRecord event does not accept any callback method or any after save event to handle custom action. Current force:createRecord always redirects to the newly created record. But in case if you want to just close the force:createRecord popup after save and refresh some other related component using the refresh is not possible.

So, is it really impossible? If so, what are current workarounds here?

1 Answer 1

3

Idea has been created regrading the Callback method for force:createRecord event to redirect or refresh after save:-

https://success.salesforce.com/ideaView?id=0873A0000003V4hQAE

You have to go for Custom Lightning Component with same functionality without using e.force:createRecord and you will be able to Callback after the record was created like:-

// Configure response handler
    action.setCallback(this, function(response) {
        var state = response.getState();
        if(component.isValid() && state === "SUCCESS") {
            component.set("v.account", response.getReturnValue());
        } else {
            console.log('Problem getting account, response state: ' + state);
        }
    });
3
  • Then after the object will be changed I will have to go to the component and update it as well. Not a very good solution, but I agree that it seems to be the only one right now.
    – iloveseven
    Aug 15, 2018 at 10:26
  • Exactly @iloveseven Aug 15, 2018 at 10:28
  • Also I found this, but it will just facilitate the development of the custom component for a record creation.
    – iloveseven
    Aug 15, 2018 at 10:29

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.