Validation Rule
  • 22 Aug 2024
  • 4 Minutes to read
  • Dark
    Light

Validation Rule

  • Dark
    Light

Article summary

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.

Note:
Validation Rules can only be created on the ConfigurationFolder with the following Data Structure,

Types of Validation Rule

Validation RuleDescription
Advanced Validation RuleAdvanced Validation Rule uses Statement Rules to trigger the validation. By default, this rule is set to output an Outcome Data as null.
Validation FlowValidation 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 RuleValidation 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.

ValidationsDescription
validationFatalUsed to Block a user when an invalid entry is made and is not acceptable.
warning_darkWarningUsed to Warn a user when an invalid entry is made and is acceptable.
IgnoredUsed to show when a user enters valid values.
Warning:
If the Validation is set to Fatal, an Entity will not be created by any means (Folder Actions, Forms, Flows, Page, Dashboards, etc.) unless the value meets the validation expectation.

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.

Prerequisite:
  • 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.

  1. Click on the Configuration Folder > Validation Rule > Advanced Validation Rule. Give a Name and Click on Create.
  2. Rule Designer Window appears. Configure the Rule to throw a validation if the age is less than 18.
  3. Navigate to Result > Outcome Data > Edit > ADD. An Edit Value Dialog box appears.
  4. 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.

  5. Run the Flow where the Form and Create Step are added.The form will appear to fill the Employee Details, enter a Name and enter any age less than18.
  6. 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. 

Note:
Validation Flow only allows synchronous flow steps. To know more about Synchronous flow steps, refer to the article About Sync and Async Sub Flows.
  1. Navigate to the Configuration Folder of the Data Structure > Validation Rule > Validation Flow. Give a Name and click Create.
  2. Flow Designer Window appears with Start Step, Valid and Invalid End Step. Validation will be configured to Invalid End Step.
  3. Add a Rule Step and Configure the Rule to return True if the Name contains the letter "Z". Refer to the following image.
  4. Connect True to Invalid Step and False to Valid Step.
  5. 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.
  6. Run the Flow where the Form and Create Steps are added.
    The Form will appear to fill the Employee Details. Enter any name with the letter Z and enter any age less than 18. 
  7. 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.

Note:
The Name assigned to the Validation Rule will be displayed as the Validation Message in the Error.
  1. Click on the Configuration Folder > Validation Rule > Validation Rule. Give a Name and click Create. 
  2. Rule Designer Window appears. Configure the Rule to evaluate True if the Age is less than 60.
  3. Save and Close the Rule Designer.
  4. Run the Flow where the Form and Create Steps are added.
  5. 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.


Was this article helpful?