Validation rules in Document Automation
- Updated: 2025/06/16
With validation rules, you can ensure the accuracy of extracted data across multiple fields in your documents.
You can define various conditions, such as pattern matching or equality checks. When those conditions are met, you can effortlessly take action to flag errors or warnings, clean up or replace values, or set new values.
- Field Rules
- Document Rules
Field rules
Field-level rules are designed to create rules specifically for individual fields. These rules contain a condition that is followed by a set of actions to be performed if the condition is met and is implicitly associated with the highlighted field.
These rules are processed before document-level validation rules.
Document Rules

- You can select one or more fields where these actions can be applied.
- The document rules can be structured with dependencies between fields, and their execution order is crucial. It is important to maintain the sequence.
- If you are using formula validation in document rules, ensure that all the fields used in the formula of the condition are also be included in the action fields.
- You must enter all the populated fields while adding a
field or document rule to get the Update option
enabled.
For example, you must add an Action value for selected Action type and then update the learning instance.
In the following video, you can observe how validation rules are utilized within documents to enhance the process of data extraction.
Available conditions
A condition is expressed as a logical rule that evaluates the state or values of certain fields that must be met for an action to occur. Below is the list of available conditions for Number data type:
Action type | Description |
---|---|
equal to | Validates whether data in a field is equal to a certain value. |
not equal to | Validates whether data in a field is not equal to a certain value. |
contains | Validates whether data in a field contains a certain value. |
doesn't contain | Validates whether data in a field does not contain a certain value. |
starts with | Validates whether data in a field starts with a certain value. |
doesn't start with | Validates whether data in a field does not start with a certain value. |
ends with | Validates whether data in a field ends with a certain value. |
doesn't end with | Validates whether data in a field does not end with a certain value. |
is empty | Validates whether data in a field is empty. |
is not empty | Validates whether data in a field is not empty. |
does match regex | Validates whether data matches the defined regular expression. See Regex pattern validation. |
does not match regex | Validates whether data does not match the defined regular expression. See Regex pattern validation. |
does match formula | Validates whether data matches the defined formula.
See Formula validation. Note: This action type is available only for
Number data type. |
does not match formula | Validates whether data does not match the defined
formula. See Formula validation. Note: This action type is available only for
Number data type. |
is in list | Validates whether data is part of a
list. Note: This action type
is only available for Text and
Address data types. |
is not in list | Validates whether data is not part of a
list. Note: This action type
is only available for Text and
Address data types. |
Available actions
An action is associated with an operation that is performed when certain conditions are met. Below is the list of all the available actions:
Action type | Description | Example |
---|---|---|
set value | If the specified condition meets, the set value action sets the specified value for the selected fields. |
|
clear value | If the specified condition meets, the clear value action clears the values of the selected fields. |
|
show error | If the specified condition meets, the show error action shows the error message for the selected fields. |
|
show warning | If the specified condition meets, the show warning action shows the warning message for the selected fields. |
|
replace | If the specified condition meets, the replace action replaces the values of the selected fields. |
|
regex extract | If the specified condition meets, the
regex extract action applies a
regular expression to the extracted value to retrieve a specific
sub-string. If the specified condition is not met, then empty
string is returned. See Regex pattern validation. Note: The regex
extract action extracts only the first match
found in the value based on the specified regex
pattern. |
|
Examples
The following are some sample use cases where validation rules can be used to enhance the data extraction results:
Use case | Condition | Condition value | Action | Action values |
---|---|---|---|---|
Replace a character You can use validation rules to replace a character. For example, you could replace the letter l in the extracted data with the number 1 when the extracted data contains only numbers. |
contains | l | replace |
|
Remove spaces You can use validation rules to remove spaces from extracted data. For example, you could remove any spaces from IDs and account numbers. |
does match regex | [\s\S]+ | replace |
|
Remove characters from string You can use validation rules to remove characters from extracted data. For example, you could extract only the numbers in "Total: $100". |
does match regex | [\s\S]+ | regex extract | \d+ |
Use formula validation to validate calculation You can use validation rules to check for values that involve calculations. For example, let us say an invoice includes values such as subtotal, sales tax, shipping and handling charges, and total amount. You could validate the total amount by adding the subtotal, sales tax, and shipping and handling. Similarly, you can also validate the subtotal amount by subtracting the total amount, shipping and handling charges, and sales tax. |
Note: We have used two conditions in this
example. The first condition checks if the total amount is
correct and the second one checks the subtotal amount.
|
|
show error | Incorrect total amount or subtotal. Please validate. |