UTIL_ValidationRule.ValidationError
Class
apex
global class UTIL_ValidationRule.ValidationErrorRepresents a single validation error or warning.
Since: 1.0
Fields
| Field | Description |
|---|---|
| global String fieldName | The field API name to display the error on (may be null for page-level). |
| global String groupName | The validation rule group DeveloperName. |
| global String message | The error message to display. |
| global Id recordId | The record ID (available except in before insert). |
| global Integer recordIndex | The record index in the trigger list (for before insert). |
| global String ruleName | The DeveloperName of the validation rule that failed. |
| global String severity | The severity ('Error' or 'Warning'). |
| global Boolean shadowMode | True if this error is from a rule in shadow mode. |
Methods
| Method | Description |
|---|---|
| global ValidationError(String ruleName, String message, String fieldName, String severity) | Constructs a new ValidationError. |
Method Details
ValidationError
apex
global ValidationError(String ruleName, String message, String fieldName, String severity)Constructs a new ValidationError.
Parameters:
ruleName(String) - The rule DeveloperNamemessage(String) - The error messagefieldName(String) - The field API name (may be null)severity(String) - The severity level
Since: 1.0
Example:
apex
UTIL_ValidationRule.ValidationError instance = new UTIL_ValidationRule.ValidationError('myName', 'An error occurred', 'myName', 'Error');Field Details
fieldName
apex
@AuraEnabled global String fieldNameType: String
The field API name to display the error on (may be null for page-level).
Since: 1.0
Example:
apex
String value = instance.fieldName;groupName
apex
@AuraEnabled global String groupNameType: String
The validation rule group DeveloperName.
Since: 1.0
Example:
apex
String value = instance.groupName;message
apex
@AuraEnabled global String messageType: String
The error message to display.
Since: 1.0
Example:
apex
String value = instance.message;recordId
apex
@AuraEnabled global Id recordIdType: Id
The record ID (available except in before insert).
Since: 1.0
Example:
apex
Id value = instance.recordId;recordIndex
apex
@AuraEnabled global Integer recordIndexType: Integer
The record index in the trigger list (for before insert).
Since: 1.0
Example:
apex
Integer value = instance.recordIndex;ruleName
apex
@AuraEnabled global String ruleNameType: String
The DeveloperName of the validation rule that failed.
Since: 1.0
Example:
apex
String value = instance.ruleName;severity
apex
@AuraEnabled global String severityType: String
The severity ('Error' or 'Warning').
Since: 1.0
Example:
apex
String value = instance.severity;shadowMode
apex
@AuraEnabled global Boolean shadowModeType: Boolean
True if this error is from a rule in shadow mode.
Since: 1.0
Example:
apex
Boolean value = instance.shadowMode;