- 19 Sep 2022
- 4 Minutes to read
- Print
- DarkLight
Validation Rule
- Updated on 19 Sep 2022
- 4 Minutes to read
- Print
- DarkLight
Overview
The validation Rule ensures the data integrity for the objects created within Data Structure. Objects in Data Structure can be created via Folder Actions, Forms, Flows, Page, Dashboards, etc. Validation Rule uses Flows and Rules to trigger custom Validations.
Purpose of Validation Rule
Decisions have various methods to validate the data directly at the source (refer to Validations Overview), But when the data comes from any external source, has not interacted with any user, and has not been validated at the source, Validation Rules can be used to validate the data before saving the data in the Data Structures.
Actions to create Validation Rules can be found on the top Actions bar of a Configuration Folder.
Types of Validation Rule
Validation Rule | Description |
---|---|
Advanced Validation Rule | Advanced Validation Rule uses Statement Rules to trigger the validation. By default, this rule is set to output an Outcome Data as null. |
Validation Flow | Validation Flow uses Flows to trigger the Validation. This Flow has two output steps Valid and Invalid. Invalid Output Step will be used to configure Validation. |
Validation Rule | Validation Rule uses Statement Rules to trigger the Validation. It enforces a True/False evaluation and outputs the rule's Name as a validation. |
Configuration of all types of Validation Rules is explained with an example further in this article.
Validation Levels
Three levels of Validation can be configured in Validation Rules.
Validations | Description | |
---|---|---|
Fatal | Used to Block a user when an invalid entry is made and is not acceptable. | |
Warning | Used to Warn a user when an invalid entry is made and is acceptable. | |
Ignored | Used to show when a user enters valid values. |
Examples
In the following examples, we will see how Validation Rule can be used to throw a Custom Validation Message and block a flow from creating an Entity object within an Entity Data Structure.
- Created an Entity Data Structure with Name and Age Field. Refer to Creating Entities.
- Created a Form Employee Details to Fill in the Name and Age. Refer to Create Forms.
- In a Flow Designer, added a Form and a Create Step to create an Entity with a Flow. Refer to the Entity Structure CRUD Actions article to create an Entity within a Data Structure.
Configuration for Advanced Validation Rule
Advanced Validation Rule uses Statement Rules to trigger the validation. By default, this rule is set to output an Outcome Data as null. Validations can be customized to trigger both the Outcome Data of a Rule.
- Click on the Configuration Folder > Validation Rule > Advanced Validation Rule. Give a Name and Click on Create.
- Rule Designer Window appears. Configure the Rule to throw a validation if the age is less than 18.
- Navigate to Result > Outcome Data > Edit > ADD. An Edit Value Dialog box appears.
- Configure Details, Level, and Reason from the Dialog Box. Click OK. Save and Close the Rule Designer.Note:Text added in the Reason Field will be displayed as a Validation Statement.
- Run the Flow where the Form and Create Step are added.
- As soon as the Form is submitted, the Flow will get blocked with an Error Message.
The highlighted text in the above image corresponds to the text entered in the Reason Field while configuring the Result in the Rule Designer.
Configuration for Validation Flow
Validation Flow uses Flow Steps to Configure the Validation. It has 2 output Steps Valid and Invalid. The Invalid output step is used to configure the Validation Details.
- Navigate to the Configuration Folder of the Data Structure > Validation Rule > Validation Flow. Give a Name and click Create.
- Flow Designer Window appears with Start Step, Valid and Invalid End Step. Validation will be configured to Invalid End Step.
- Add a Rule Step and Configure the Rule to return True if the Name contains the letter "Z". Refer to the following image.
- Connect True to Invalid Step and False to Valid Step.
- Click in the Invalid Step > Properties > Input > Map Validation Issues to Constant. Click on the Edit Icon and configure Details, Level, and Reason from the Dialog Box. Click OK.Note:Text added in the Reason field will be displayed as a Validation Statement.
- Run the Flow where the Form and Create Steps are added.
- As soon as the Form is submitted, the Flow will get blocked with an Error Message.
The highlighted text in the above image corresponds to the text entered in the Reason Field while configuring the Invalid End Step in the Flow Designer.
Configuration for Validation Rule
The Validation Rule is set to be Fatal by default. It uses Statement Rule to evaluate the Result. If the Evaluated Result is False, then it will trigger the Validation.
- Click on the Configuration Folder > Validation Rule > Validation Flow. Give a Name and click Create.
- Rule Designer Window appears. Configure the Rule to evaluate True if the Age is less than 60.
- Save and Close the Rule Designer.
- Run the Flow where the Form and Create Steps are added.
- As soon as the Form is Submitted, the Flow will get blocked with an Error Message.
The highlighted text in the above image corresponds to the Name assigned to the Validation Rule.