Applies to version 2020.1.3; author: Konrad Wojtycza
One of the basic functions of WEBCON BPS forms is validating if the fields are completed correctly. This article describes the validation mechanism.
The example workflow
In the example “Purchase order” workflow, all validation actions were configured on the “Register” path.
Fig. 1. The fragment of the “Purchase order” workflow
Validation actions have been configured in the “Actions” tab on the “Register” path:
Fig. 2. The “Actions” tab
The fragment of the “Purchase order” form with validated fields:
Fig. 3. The fragment of the “Purchase order” form
To configure the “Validate form” action, indicate the validation condition in the “Validation rule” section, and define the message displayed for validation error. The rule may contain all syntax elements available for business rules – it should return POSITIVE, TRUE or 1 value (if the condition is met), and NEGATIVE, FALSE or 0 (if the condition is not met). You can also define the message for successful validation.
Fig. 4. The configuration of the validation action
You can dynamically display the values from the form in the “Message for validation error” and “Message for successful validation” fields – just add them using the expression editor (…).
Fig. 5. The expression editor
The example message for validation error:
Fig. 6. The error message
In the case of configuring more complex validations, you can check the correctness of the validation condition – enter the expression editor of the validation rule and click Test. The Expression preview window will be displayed, which will return a value determined by checking the condition based on the value from the indicated process instance.
To test the rule, enter the appropriate workflow instance ID.
Fig. 7. The expression editor of the rule
Validations can check not only numerical values, but also date and time fields, text field contents, picker fields and values of other form fields.
Fig. 8. The configuration of the validation action for checking the date and time fields
The validation condition may also contain an SQL query that can, for example compare values returned from the database with values entered on the form. The appropriate SQL query syntax also allows the expression itself to be a validation condition.
Fig. 9. The configuration of the validation action using the SQL expression
The checkbox can also be used as an independent validation condition. The TRUE value is returned if the field is checked, and FALSE – when unchecked.
Fig. 10. The configuration of the validation action with the rule based on the checkbox field
You can use the validation action to check if all the fields on the form contain correct data.