Shared Designer Elements > System Defaults > Default Form Validation Rules. To keep all form validation..." /> Shared Designer Elements > System Defaults > Default Form Validation Rules. To keep all form validation..."> Creating a Form Validation Rule - Validation & Visibility
Creating a Form Validation Rule
  • Updated on 09 May 2013
  • 3 minutes to read
  • Print
  • Dark
    Light

Creating a Form Validation Rule

  • Print
  • Dark
    Light

This tutorial demonstrates how to use Validation Rules on Forms in Decisions . Validation Rules evaluate a form value and return a “True” or “False” outcome, depending on whether the form value satisfies the rule’s condition(s). IfValidation Rule returns “False” , validation brakes and custom message is displayed on the Form control. The platform includes several form validation rules, found under System > Designers > Catalog > System Defaults > Default Form Validation Rules. To keep all form validation rules together for organizational purposes, you could create additional validation rules here (however, this is not required).
Example
In this scenario, a minimum age for an applicant is at least 18 years old. A validation rule will evaluate date of birth of the applicant against the current date and enforce this business rule for minimum age. Our example validation rule will expect a date. If the date of birth plus 18 years is earlier than current date, the rule will return a truthful outcome. Otherwise, it will return false and show validation message.
We begin in the Designer Folder with clicking Create Rule > Create Rule on the Folder Actions Panel.
2018-01-03_153553.png

In the resulting window we Name the Rule “Applicant Over Age 18” and click Ok to proceed to the Rule Designer.
2018-01-03_154506.png

Our Rule needs “Date Of Birth” Date input to evaluate. In the Start Rule window we click Show Editor under Rule Input Data to define inputs.
2018-01-03_154543.png

Then, in Data Definitions window we Name our input and pick Date Time data type. Click Close to save and continue.
2018-01-03_154630.png

Rule Input Data is configured and we click Add New Rule Step to start building our Rule .
In the resulting window we pick our DOB data to evaluate and click Next .
2018-01-03_154716.png

To evaluate our date of birth value we are going to create a simple Flow instead of a verb. We expand Common > Evaluate category, pick Evaluate and click Next .
2018-01-03_154754.png

Then, we click Create under Flow picker.
2018-01-03_154815.png

We Name the Flow and click Ok to proceed to the Flow Designer.
2018-01-03_154853.png

In the Flow Designer we need to create a Date Of Birth as a Flow Input . We selectStart Step and in the Step Editor window we locate Flow Input Data settings and click Show Editor. In theData Definitions window we Name our data and pick Date Time type. Then, in the Mapping settings for our date we Select Value of DOB date. Click Close when finished.
2018-01-03_155042-1024x739.png

Next, we add Add Years step from All Steps [Catalog] > Data > Dates category.
2018-01-03_155329-1024x768.png

Add Years step takes in source Date (Date Time) andyears (Int) inputs. For source Date we Select Value of our DOB flow input and for years we define Constant 18 . The output from this step will be a calculated date that we need to compare with current date and check if it is less than current date.
2018-01-03_155438-1024x771.png

On the outcome path from Add Years step we add Less Than (Date) step from All Steps [Catalog] > Data > Dates category.
2018-01-03_155537-1024x752.png

Next, we are going to configure Inputs forLess Than (Date) step. For the end Date input we select Current Date Time Mapping Type.
2018-01-03_155622-1024x747.png

For the first Date input, we Select Value of Add Years_Output.
2018-01-03_155645-1024x750.png

Then, we locate and expand Outcomes settings on the Less Than (Date) step and uncheck Expose Step as a Rule check-box.
2018-01-03_155728-1024x753.png

Next, we connect Done outcome from Less Than (Date) to theEnd Step in our Flow . Our Flow has to output Boolean Result (True or False) . For the Result input on the End Step we Select Value ofLess Than Date_Output.
2018-01-03_155844-1024x740.png

This completes our evaluation Flow . We can save the Flow and closeFlow Designer.
2018-01-03_155917.png

Back in the Rule Designer we click Done to save and close Rule Step Builder dialog.
2018-01-03_155957.png

Lastly, in order for us to be able to use this Rule as a Validation Rule on the Form , we need to change its Behavior . On the Rule Settings panel we locate Behavior Type in the Output section and pick Form Rule.
2018-01-03_160029.png

This completes our Rule Design . We can save the Rule and close Rule Designer.

2018-01-03_160111.png

The validation rule is established in the Form Designer , from the Surface level for the form. To learn how to apply the rule, see the topic "Applying a Form Validation Rule."

Was this article helpful?