I am getting below error while saving record. Record is saved but unable to redirect to detail page.
This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'fire' of undefined] Callback failed: apex://CreateOpportunityController/ACTION$SaveOppRecord Failing descriptor: {c:CreateOpportunity}
Below is lightning helper:
var saveAction = component.get("c.SaveOppRecord");
saveAction.setParams({
"oppRec": component.get("v.opportunityRec"),
"AccountId": component.get("v.accountId")
});
saveAction.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
if(response.getReturnValue().startsWith('SUCCESS')) {
var self = this;
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
"title": "Success!",
"message": "The Opportunity record has been created successfully."
});
toastEvent.fire();
this.cancelOpportunity(component, event);
}
}
});
$A.enqueueAction(saveAction);
one.app
containers.