0

Is it possible to update a copy of the $A namespace object to handle callbacks where they are not otherwise handled?

For example, the force:createRecord event has the panelOnDestroyCallback callback function that allows us to perform a function when the Create Record modal is closed:

$A.get('e.force:createRecord').setParams({
  entityApiName: 'ExampleObject__c',
  panelOnDestroyCallback: () => { // <-- This is not available for force:editRecord
    console.log('The Create Record modal has been closed!');
  },
}).fire();

On the other hand, the force:editRecord event does not have this callback available.

Is it possible to create a copy of the callback from one event and apply it to another event?

For example, is it possible to apply the panelOnDestroyCallback callback parameter from force:createRecord to the force:editRecord event?

Here's an example of what I'm hoping to accomplish:

(function () {
  const $createRecord = $A.get('e.force:createRecord');
  const $editRecord = $A.get('e.force:editRecord');
  
  // Something like this?
  $editRecord.handleParam['panelOnDestroyCallback'] = $createRecord.handleParam['panelOnDestroyCallback'];
  
  $editRecord.setParams({
    recordId: 'a00XXXXXXXXXXXXXXXX',
    panelOnDestroyCallback: () => {
      console.log('The Edit Record modal has been closed!');
    },
  }).fire();
})();

1 Answer 1

1

In summary, this shouldn't be possible. Anything not documented must be presumed impossible. Your best bet would be to suggest an Idea on the IdeaExchange.

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.