You need to sign in to do that
Don't have an account?
Mark Young
Multiple Custom Validation Errors - Apex Insert
Hi,
When performing a database insert, I'm only able to get back the first custom validation error. Is there any way to get them all back? Documentation says that all validation rules are evaluated.
I'm currently doing the following:
This should return all errors back, or else users are forced to do multiple round trips.
Any way to do this?
Thanks
When performing a database insert, I'm only able to get back the first custom validation error. Is there any way to get them all back? Documentation says that all validation rules are evaluated.
I'm currently doing the following:
Code:
Contact c = new Contact(); Database.SaveResult result = Database.insert(c, false); // Have multiple rules requiring fields to be set System.debug('Num errors: ' + result.getErrors().size()); // Returns 1
This should return all errors back, or else users are forced to do multiple round trips.
Any way to do this?
Thanks