UTIL_ValidationRule.ValidationResult
Class
global class UTIL_ValidationRule.ValidationResultResult of validating a single record. Contains all validation errors/warnings for that record.
Since: 1.0
Properties
| Property | Description |
|---|---|
| global List errors | List of validation errors/warnings for this record. |
| global Boolean isValid | 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). |
Methods
| Method | Description |
|---|---|
| global String getErrorMessage() | Gets concatenated error message string. |
| global List getErrorsBySeverity(String severity) | Gets errors filtered by severity. |
| global ValidationResult(Integer recordIndex, Id recordId) | Constructs a new ValidationResult for the given record. |
Property Details
errors
global List<UTIL_ValidationRule.ValidationError> errorsType: List
List of validation errors/warnings for this record.
Since:
Example:
isValid
global Boolean isValidType: Boolean
True if the record passed all validation rules.
Since:
Example:
Method Details
ValidationResult
global ValidationResult(Integer recordIndex, Id recordId)Constructs a new ValidationResult for the given record.
Parameters:
recordIndex(Integer) - The index in the trigger listrecordId(Id) - The record ID (may be null for before insert)
Since: 1.0
Example:
UTIL_ValidationRule.ValidationResult instance = new UTIL_ValidationRule.ValidationResult(10, recordId);getErrorMessage
global String getErrorMessage()Gets concatenated error message string.
Returns: String - All error messages joined by newlines
Since: 1.0
Example:
String result = instance.getErrorMessage();getErrorsBySeverity
global List<UTIL_ValidationRule.ValidationError> getErrorsBySeverity(String severity)Gets errors filtered by severity.
Parameters:
severity(String) - The severity to filter by ('Error' or 'Warning')
Returns: UTIL_ValidationRule.ValidationError - List of errors matching the severity
Since: 1.0
Example:
List<ValidationError> result = instance.getErrorsBySeverity('Error');Field Details
recordId
global Id recordIdType: Id
The record ID (available in all contexts except before insert).
Since: 1.0
Example:
Id value = instance.recordId;recordIndex
global Integer recordIndexType: Integer
The index of the record in the trigger list (for before insert correlation).
Since: 1.0
Example:
Integer value = instance.recordIndex;