You need to sign in to do that
Don't have an account?
Rung41
Custom Error not displaying on page
I have created a trigger to prevent users from deleting an Account if a field is populated. However, instead of the error message appearing on the Account page I get this:
Validation Errors While Saving Record(s) |
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "This Account has a Community Code therefore it can not be deleted".
Do I need a "catch"?
My trigger: trigger CommunityCode on Account (before delete) { if(System.Trigger.IsDelete) { for (Account a : Trigger.old) if (a.Community_Code__c != Null) { a.addError ('This Account has a Community Code therefore it can not be deleted'); } } }
|
replace the line
with
and let me know if this works
No dice. I got
Click here to return to the previous page.
Hello,
Did you find any solution to this problem?
How can we catch delete errors on triggers in a VF page?