Trigger.addError
in before delete trigger always shows the error message in a new page.
Instead of showing the error message in new page, I need to show in same standard page.
Is it possible ?
And I have the condition to not delete the record when the active field is checked.
trigger OpportunityclosedWon on Opportunity (before Delete) {
for (Opportunity opp : trigger.Old) {
if (opp.StageName == 'Closed Won') {
opp.stagename.adderror('You cannot delete Closed Won Opportunity');
}
}
}