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

Using addError to add multiple Errors.
The following code only shows Error 2. How can one modify it to show both errors (short of accumulating all errors and showing as one large string).
trigger testAccountError on Account (after insert) {
for (Accout a: Trigger.New) {
a.addError('Error 1');
a.addError('Error 2');
}
}
trigger testAccountError on Account (after insert) {
for (Accout a: Trigger.New) {
a.addError('Error 1');
a.addError('Error 2');
}
}
If you want to show new line in the message, u might try '</br>' or '\n' in the addError(), something like this:
string br = '</br>';
a.addError('Error 1'+br+'Error 2 ');
hth
Prabhan