UTIL_ValidationRule.ValidationResult
Class
apex
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
apex
global String getErrorMessage()Gets concatenated error message string.
Returns String — All error messages joined by newlines
Example
apex
String result = instance.getErrorMessage();getErrorsBySeverity
apex
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
apex
List<ValidationError> result = instance.getErrorsBySeverity('Error');Constructors
| Constructor | Description |
|---|---|
| global ValidationResult(Integer recordIndex, Id recordId) | Constructs a new ValidationResult for the given record. |
ValidationResult(Integer recordIndex, Id recordId)
apex
global ValidationResult(Integer recordIndex, Id recordId)Constructs a new ValidationResult for the given record.
Parameters
| Parameter | Type | Description |
|---|---|---|
recordIndex | Integer | The index in the trigger list |
recordId | Id | The record ID (may be null for before insert) |
Example
apex
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
apex
global List<UTIL_ValidationRule.ValidationError> errorsType: List
List of validation errors/warnings for this record.
isValid
apex
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
apex
global Id recordIdType: Id
The record ID (available in all contexts except before insert).
Example
apex
Id value = instance.recordId;recordIndex
apex
global Integer recordIndexType: Integer
The index of the record in the trigger list (for before insert correlation).
Example
apex
Integer value = instance.recordIndex;