# DTO_FlowValidationError

**Class** · Group: `Data Transfer Objects`

Learn it: [Validation guide](/validation-guide)

<div class="apex-member apex-class">

```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.

**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](/reference/apex/flow-executevalidationrules), [UTIL_ValidationRule.ValidationError](/reference/apex/util-validationrule-validationerror)

</div>

---

## Fields

| Field | Description |
|-------|-------------|
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [fieldName](#fieldname) | The API name of the field associated with this error, if specified in the validation rule's FieldApiName__c field. |
| global [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [isShadowMode](#isshadowmode) | True if this error was generated by a validation rule running in shadow mode. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [message](#message) | The user-facing error message from the validation rule's ErrorMessage__c field. |
| global [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm) [recordIndex](#recordindex) | The zero-based index of the record in the input collection that generated this error. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [ruleName](#rulename) | The DeveloperName of the ValidationRule__mdt record that generated this error. |
| global [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [severity](#severity) | The severity level of this validation result. |

### fieldName

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

**Type:** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm)

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.

**Example**

```apex
String value = instance.fieldName;
```

### isShadowMode

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

**Type:** [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm)

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.

**Example**

```apex
Boolean value = instance.isShadowMode;
```

### message

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

**Type:** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm)

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.

**Example**

```apex
String value = instance.message;
```

### recordIndex

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

**Type:** [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm)

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.

**Example**

```apex
Integer value = instance.recordIndex;
```

### ruleName

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

**Type:** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm)

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.

**Example**

```apex
String value = instance.ruleName;
```

### severity

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

**Type:** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm)

The severity level of this validation result. Either 'Error' for blocking
validation failures or 'Warning' for non-blocking informational messages.

**Example**

```apex
String value = instance.severity;
```
