Skip to content

DTO_FlowValidationError

Class · Group: Data Transfer Objects

apex
global inherited sharing class DTO_FlowValidationError

Represents a single validation error or warning for Flow display. Contains details about the validation rule that failed, the error message, and metadata for field-level error presentation in Flow screens. This class is a top-level global class to support LWC Flow screen components, as Apex inner classes cannot be used as property types in LWC configurations.

Since: 1.0

Example:

apex
DTO_FlowValidationError error = new DTO_FlowValidationError();
error.ruleName = 'RequireEmail';
error.message = 'Email is required';
error.fieldName = 'Email__c';
error.severity = 'Error';

See Also: FLOW_ExecuteValidationRules, UTIL_ValidationRule.ValidationError


Fields

FieldDescription
global String fieldNameThe API name of the field associated with this error, if specified in the validation rule's FieldApiName__c field.
global Boolean isShadowModeTrue if this error was generated by a validation rule running in shadow mode.
global String messageThe user-facing error message from the validation rule's ErrorMessage__c field.
global Integer recordIndexThe zero-based index of the record in the input collection that generated this error.
global String ruleNameThe DeveloperName of the ValidationRule__mdt record that generated this error.
global String severityThe severity level of this validation result.

Field Details

fieldName

apex
@InvocableVariable(label='Field Name') global String fieldName

Type: String

The API name of the field associated with this error, if specified in the validation rule's FieldApiName__c field. May be null for record-level validation errors. Use this to highlight specific fields in the UI or position error messages near fields.

Since: 1.0

Example:

apex
String value = instance.fieldName;

isShadowMode

apex
@InvocableVariable(label='Is Shadow Mode') global Boolean isShadowMode

Type: Boolean

True if this error was generated by a validation rule running in shadow mode. Shadow mode errors are logged for monitoring but do not block the save operation. Use this to distinguish between real errors and shadow mode observations in the UI.

Since: 1.0

Example:

apex
Boolean value = instance.isShadowMode;

message

apex
@InvocableVariable(required=true label='Message') global String message

Type: String

The user-facing error message from the validation rule's ErrorMessage__c field. This message should be displayed to end users and may contain merge field values.

Since: 1.0

Example:

apex
String value = instance.message;

recordIndex

apex
@InvocableVariable(label='Record Index') global Integer recordIndex

Type: Integer

The zero-based index of the record in the input collection that generated this error. Use this to correlate errors with specific records when validating multiple records in a single request.

Since: 1.0

Example:

apex
Integer value = instance.recordIndex;

ruleName

apex
@InvocableVariable(required=true label='Rule Name') global String ruleName

Type: String

The DeveloperName of the ValidationRule__mdt record that generated this error. Use this to identify which specific rule failed for debugging or custom error handling.

Since: 1.0

Example:

apex
String value = instance.ruleName;

severity

apex
@InvocableVariable(required=true label='Severity') global String severity

Type: String

The severity level of this validation result. Either 'Error' for blocking validation failures or 'Warning' for non-blocking informational messages. Corresponds to UTIL_ValidationRule.SEVERITY_ERROR and UTIL_ValidationRule.SEVERITY_WARNING constants.

Since: 1.0

Example:

apex
String value = instance.severity;