I've built a lightning component that runs when the user clicks the standard 'New' button on the Opportunities related list on Account. My component invokes e.force.createRecord meaning it shows the Opportunity record creation modal when ran.
The Opportunity record creation modal has 3 buttons (Cancel, Save and New, and Save). Is there a way to define separate redirects for Cancel and Save? Currently I can define one redirect that gets applied to both the Cancel and Save button, via the following code:
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Opportunity",
// Prepopulate values:
"defaultFieldValues": {
"AccountId" : recordId //,
// Add more default values here if desired:
},
"panelOnDestroyCallback": function(event) {
window.location.href = "https://www.google.com";
},
"recordTypeId":rtDet.id
});
createRecordEvent.fire();