UTIL_ValidationRule.ValidationResult
Class · Group: Validation
Learn it: Fast Start - Custom Validations and Validation guide
global class UTIL_ValidationRule.ValidationResultResult of validating a single record. Contains all validation errors/warnings for that record.
Methods
| Method | Description |
|---|---|
| global String getErrorMessage() | Gets concatenated error message string. |
| global List<UTIL_ValidationRule.ValidationError> getErrorsBySeverity(String severity) | Gets errors filtered by severity. |
getErrorMessage
global String getErrorMessage()Gets concatenated error message string.
Returns String — All error messages joined by newlines
Example
String result = instance.getErrorMessage();getErrorsBySeverity
global List<UTIL_ValidationRule.ValidationError> getErrorsBySeverity(String severity)Gets errors filtered by severity.
Parameters
| Parameter | Type | Description |
|---|---|---|
severity | String | The severity to filter by ('Error' or 'Warning') |
Returns UTIL_ValidationRule.ValidationError — List of errors matching the severity
Example
List<ValidationError> result = instance.getErrorsBySeverity('Error');Constructors
| Constructor | Description |
|---|---|
| global ValidationResult(Integer recordIndex, Id recordId) | Starts the result of one record with no errors, so isValid is true until an error with Error severity, outside shadow mode, is added to errors. |
ValidationResult(Integer recordIndex, Id recordId)
global ValidationResult(Integer recordIndex, Id recordId)Starts the result of one record with no errors, so isValid is true until an error with Error severity, outside shadow mode, is added to errors.
Parameters
| Parameter | Type | Description |
|---|---|---|
recordIndex | Integer | The index in the trigger list |
recordId | Id | The record ID (may be null for before insert) |
Example
UTIL_ValidationRule.ValidationResult instance = new UTIL_ValidationRule.ValidationResult(10, recordId);Properties
| Property | Description |
|---|---|
| global List<UTIL_ValidationRule.ValidationError> errors | List of validation errors/warnings for this record. |
| global Boolean isValid | True if the record passed all validation rules. |
errors
global List<UTIL_ValidationRule.ValidationError> errorsType: List
List of validation errors/warnings for this record.
isValid
global Boolean isValidType: Boolean
True if the record passed all validation rules.
Fields
| Field | Description |
|---|---|
| global Id recordId | The record ID (available in all contexts except before insert). |
| global Integer recordIndex | The index of the record in the trigger list (for before insert correlation). |
recordId
global Id recordIdType: Id
The record ID (available in all contexts except before insert).
Example
Id value = instance.recordId;recordIndex
global Integer recordIndexType: Integer
The index of the record in the trigger list (for before insert correlation).
Example
Integer value = instance.recordIndex;