Validation mechanisms on workflows

applies to version: 8.2.x, author: Kamil Nędza

How to shield your users from simple mistakes?

Data validation plays an important part in workflows. A foolproof validation structure in your system can protect it from simple human errors, like a missing digit in a bank account number, forgetting an important Form field, not adding an attachment, it can also block a certain element if one of the values in a field exceeds a certain limit etc. The possibilities are endless. This article will demonstrate a couple ways of configuring your workflow form to validate values entered by users.


Unconditional requirement

The simplest form of validation is to set a fields as required [Req.] on the Fields matrix tab of the workflow. This will block a user from moving down a Path to the next workflow step without entering the required values:


Fig.1. Setting certain fields as required in the Fields matrix


Required fields will be marked with a red asterisk on the form:


Rys.2. Required fields on a form


If the user fails to fill out one of the required Form fields, they will get an appropriate error message when clicking on a Path button:


Fig.3. Skipping a required Form field results in an error message.



Regular expression

Regular expressions (abbreviated as Regex) define certain sequence of characters. Using them we can require the entered value to have some sort of pattern. For example: the Polish national identification number (PESEL) is always 11 digits. With this in mind, we can avoid simple mistakes like entering too few or too many digits. In the “Style and behavior” tab for the desired Form field (we will be using Personal identity number), go to the “Regex validation” section to define that the text entered into the Personal identity number field must be exactly 11 digits:


Fig.4. Regex validation for the Personal identity number field.


If the users enters text not meeting the Regex validation requirements, they will get an appropriate message:


Fig.5. Regex validation error message if requirements are not met.


Validation via “On path” action.

The Validate form action enables us to use an SQL query to define whether an element may pass to the next workflow Step. If the validation conditions are not met, the element will not go continue down the path. As an example, we will check if a client already exists in the system based on the uniqueness of their Personal identity number. Create a Validate form action, we want this action to activate when moving down the Register path, so select On path and Register as the Action type and Path respectively. This action will check if a client’s element with the exact same Personal identity number already exists in the system:


Fig.6. Adding a Validate form action to the Register path.


Fig.7. Advanced configuration for the Validate form action


If there is another element in the system with the same Personal identity number, an error message will appear and the element will not be registered:


Fig.8. Error message about repeating Personal identity numbers


Additional path validation (JavaScript)

Additional validation can be placed on a desired workflow Path with the help of a script. For example, one can implement an message for the user, when they forgot to enter the telephone number, and ask them if they want to continue anyway. The script should be placed in the Additional path validation (JavaScript) section under the Parameters tab of the desired Path.


Fig.9. Additional validation the form of JavaScript on the Register path.


In effect, if the user clicks the Register path button without filling out the Phone number field, they will get a message asking them if they would like to continue anyway. If they decide to click Cancel, the element will remain on the current Step.


FIg.10. Site message

Leave a Reply

Your email address will not be published. Required fields are marked *