Skip to content

UTIL_ValidationRule.ValidationResult

Class

apex
global class UTIL_ValidationRule.ValidationResult

Result of validating a single record. Contains all validation errors/warnings for that record.


Methods

MethodDescription
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

ParameterTypeDescription
severityStringThe 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

ConstructorDescription
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

ParameterTypeDescription
recordIndexIntegerThe index in the trigger list
recordIdIdThe record ID (may be null for before insert)

Example

apex
UTIL_ValidationRule.ValidationResult instance = new UTIL_ValidationRule.ValidationResult(10, recordId);

Properties

PropertyDescription
global List<UTIL_ValidationRule.ValidationError> errorsList of validation errors/warnings for this record.
global Boolean isValidTrue if the record passed all validation rules.

errors

apex
global List<UTIL_ValidationRule.ValidationError> errors

Type: List

List of validation errors/warnings for this record.

isValid

apex
global Boolean isValid

Type: Boolean

True if the record passed all validation rules.

Fields

FieldDescription
global Id recordIdThe record ID (available in all contexts except before insert).
global Integer recordIndexThe index of the record in the trigger list (for before insert correlation).

recordId

apex
global Id recordId

Type: Id

The record ID (available in all contexts except before insert).

Example

apex
Id value = instance.recordId;

recordIndex

apex
global Integer recordIndex

Type: Integer

The index of the record in the trigger list (for before insert correlation).

Example

apex
Integer value = instance.recordIndex;