UTIL_ValidationRule.ValidationError
Class
apex
global class UTIL_ValidationRule.ValidationErrorRepresents a single validation error or warning.
Constructors
| Constructor | Description |
|---|---|
| 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
| Parameter | Type | Description |
|---|---|---|
ruleName | String | The rule DeveloperName |
message | String | The error message |
fieldName | String | The field API name (may be null) |
severity | String | The severity level |
Example
apex
UTIL_ValidationRule.ValidationError instance = new UTIL_ValidationRule.ValidationError('myName', 'An error occurred', 'myName', 'Error');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. |
fieldName
apex
@AuraEnabled global String fieldNameType: 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 groupNameType: String
The validation rule group DeveloperName.
Example
apex
String value = instance.groupName;message
apex
@AuraEnabled global String messageType: String
The error message to display.
Example
apex
String value = instance.message;recordId
apex
@AuraEnabled global Id recordIdType: Id
The record ID (available except in before insert).
Example
apex
Id value = instance.recordId;recordIndex
apex
@AuraEnabled global Integer recordIndexType: Integer
The record index in the trigger list (for before insert).
Example
apex
Integer value = instance.recordIndex;ruleName
apex
@AuraEnabled global String ruleNameType: String
The DeveloperName of the validation rule that failed.
Example
apex
String value = instance.ruleName;severity
apex
@AuraEnabled global String severityType: String
The severity ('Error' or 'Warning').
Example
apex
String value = instance.severity;shadowMode
apex
@AuraEnabled global Boolean shadowModeType: Boolean
True if this error is from a rule in shadow mode.
Example
apex
Boolean value = instance.shadowMode;