Form Validation Flow

Last Updated: 04/05/2018 Introduced in Version: 4.0

This tutorial demonstrates how to use Flow as a Validation Rule on the Form. To learn about Validation Rules, please click here. Flow Validation Rule can be used for designing more advanced validations and applying them to different components on the Form. Validation Flow evaluates inputs and returns a collection of Form Issues that contain data about controls it should apply to, message it should display and breaking level of the issue.

Example:

In this example we are going to create a simple Flow with a Form. Our Form is going to have a Text Box component. We are going to apply Flow Validation Rule for this Text Box component.
We begin in a Designer Folder with clicking Create Flow on the Folder Actions Panel.

Then, we Name the Flow and click Ok to proceed to the Flow Designer.

In the Flow Designer we add Show Form component from Favorite Steps category.

Next, we Name the Form and click Create to proceed to the Form Designer.

In the Form Designer we add Button control and Text Box control to our Form.

Note: we need to remember Data Name for the Text Box control because we are going to use it later in this tutorial.

Then, we navigate to Form Settings by clicking outside of the work-space in the Form Designer. We locate Validation Rules under Form Rules section and click Add New.

In Add Validation Rules window we Name our rule. Then, we pick Flow as Validation Source and click Create to build our validation Flow.

In the resulting window we Name the Flow and click Ok to proceed to the Flow Designer.

In this Flow we can build any logic to evaluate our validation. 

First, we need to add a Flow Input data. We are going to evaluate this data and decide if validation issue should be returned.

We select Start Step in our Flow and under Flow Input Data settings we click Show Editor.

In the Data Definitions window we create a String and close the window to save and continue.

Then, we add Create Data step from Favorite Steps category.

Under Data Definitions settings for Create Data step we click Show Editor.

Here we are going to define Form Validation Issue data to use as an outcome from our Flow.

We Name our variable and locate FormValidationIssue Type. By default we set Null value for this variable.

Back in the Flow Designer we add String Equals – Case Insensitive step from All Steps [Catalog] > Data > Text category.

This is a Rule that has two input values to compare.

We locate Inputs settings and define value1 Constant ‘brake’. For value2 we Select Value of our Flow Input (My Text).

Then, on True outcome from String Equals – Case Insensitive step we add Mapping Step from All Steps [Catalog] > Data category.

To learn more on how to use Mapping Step, please click here.

With this step we are going to build our Validation Issue because we know that if our Flow executes down this path then our validation should be broken.

In the Mapping Step settings we locate Validation Issue and use Build Data Mapping Type.

We are interesting to Build few properties: Break Level, Message, and Data Name.

We pick Constant Break Level. It can be either Fatal or Warning.

Then, we create a Constant Data Name. This should match a Name of the control on the Form where we want to display validation. In this case this is a name of our Text Box.

Finally, we are going to use Text Merge.Plain Mapping Type for Message property to demonstrate that we can build a dynamic text for our Validation Issue. Click Show Editor

In the Text Merge Editor we use our Flow Input (My Text) to create a Validation Message. When finished we can click Ok to save and continue.

Then, we connect the outcome from Mapping Step and False outcome from String Equals – Case Insensitive step to the End Step.

For the End Step we need to map Form Validations output data. In the End Step Settings we locate Form Validations Input and use Build Data Mapping Type. Then, for Validation Issues property we are going to Build Array. For Item 0 in the array we Select Value of Validation Issue that we created in our Flow.

This completes our Flow. We can save the Flow and close Flow Designer.

Back in the Edit Validation Rules window we define our Triggers and Edit ‘My Text’ Flow input.

For ‘My Text’ input we use data from our Text Box Form component.

 

 

This completes our Form Design. We save the Form and close Form Designer.

In the Main Flow we connect Form outcome path to the End Step. On the top panel of the Flow Designer we click Debug Flow to test our Flow.

Form pops up in the Debugger

If we type ‘brake’ in our Text Box, we should be able to see our validation message.

If we try to Submit our Form we will see Validation issue on the Button.

If the input is valid, we can successfully submit the Form.

Additional Resources