Skip to content

UTIL_ValidationRule.ValidationError

Class

apex
global class UTIL_ValidationRule.ValidationError

Represents a single validation error or warning.


Constructors

ConstructorDescription
global ValidationError(String ruleName, String message, String fieldName, String severity)Constructs a new ValidationError.

ValidationError(String ruleName, String message, String fieldName, String severity)

apex
global ValidationError(String ruleName, String message, String fieldName, String severity)

Constructs a new ValidationError.

Parameters

ParameterTypeDescription
ruleNameStringThe rule DeveloperName
messageStringThe error message
fieldNameStringThe field API name (may be null)
severityStringThe severity level

Example

apex
UTIL_ValidationRule.ValidationError instance = new UTIL_ValidationRule.ValidationError('myName', 'An error occurred', 'myName', 'Error');

Fields

FieldDescription
global String fieldNameThe field API name to display the error on (may be null for page-level).
global String groupNameThe validation rule group DeveloperName.
global String messageThe error message to display.
global Id recordIdThe record ID (available except in before insert).
global Integer recordIndexThe record index in the trigger list (for before insert).
global String ruleNameThe DeveloperName of the validation rule that failed.
global String severityThe severity ('Error' or 'Warning').
global Boolean shadowModeTrue if this error is from a rule in shadow mode.

fieldName

apex
@AuraEnabled global String fieldName

Type: String

The field API name to display the error on (may be null for page-level).

Example

apex
String value = instance.fieldName;

groupName

apex
@AuraEnabled global String groupName

Type: String

The validation rule group DeveloperName.

Example

apex
String value = instance.groupName;

message

apex
@AuraEnabled global String message

Type: String

The error message to display.

Example

apex
String value = instance.message;

recordId

apex
@AuraEnabled global Id recordId

Type: Id

The record ID (available except in before insert).

Example

apex
Id value = instance.recordId;

recordIndex

apex
@AuraEnabled global Integer recordIndex

Type: Integer

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

Example

apex
Integer value = instance.recordIndex;

ruleName

apex
@AuraEnabled global String ruleName

Type: String

The DeveloperName of the validation rule that failed.

Example

apex
String value = instance.ruleName;

severity

apex
@AuraEnabled global String severity

Type: String

The severity ('Error' or 'Warning').

Example

apex
String value = instance.severity;

shadowMode

apex
@AuraEnabled global Boolean shadowMode

Type: Boolean

True if this error is from a rule in shadow mode.

Example

apex
Boolean value = instance.shadowMode;