You need to sign in to do that
Don't have an account?

Can you make addError() in custom before delete trigger show in red. ?
The addError() behavior in a before delete trigger results in a message on the Home tab:
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 .Contacts cannot be deleted
I want it to stay on the same tab as the delete button and display at the top in red like this
Error: Invalid Data. Review all error messages below to correct your data. Contacts cannot be deleted |
Note that addError() in a before insert trigger does put the message in red at the top (when not specifying a field)
Here is my simple before delete trigger code:
trigger contactDeleteTrigger on Contact (before delete)
{
for (Contact c: Trigger.old)
{
c.addError('Contacts cannot be deleted');
}
}
Using stadard page we can have these kind of messages only when we save info , but we cannot have this for delete actions as the page will be redirected to some predefined page. The only way is to customize the detail page usign visual force and there we can have own custom validation.
--yvk
All Answers
Using stadard page we can have these kind of messages only when we save info , but we cannot have this for delete actions as the page will be redirected to some predefined page. The only way is to customize the detail page usign visual force and there we can have own custom validation.
--yvk
OK Thank You