Get Required Value From Input Data

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

This tutorial demonstrates how to dynamically set required fields on the Form. This feature is implemented in Decisions 4.0. To learn about Required and Optional Outcome scenarios, please go through this tutorial. Sometimes, when we design a Form with some user input controls, it is hard to decide if an input should be required or optional. With this feature, our Flow can make this decision based on some data evaluation prior loading the Form.

Example.

In this example we are going to build a simple Flow with a Form. The Form is going to have a text-box control that may be set to be either required or optional. This will be set as a Form input.

We begin in the Designer Folder with clicking Create Flow on the Folder Actions Panel.

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

 

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

 

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

 

 Our Form layout looks as following. We have a Label, Text-Box and a Button to submit the Form.

For any user input controls (like Text-Box in this example) we can define an Outcome Scenarios. It may be Required Outcome Scenario (user will not be able to submit the Form without providing input), Optional Outcome Scenario (user may leave an input empty and be able to submit the Form), and Not Used (the data provided in the input will not be available in next steps in the Flow).

If we need to decide if an input should be required based on some data evaluation in the Flow, we set it to Optional Outcome Scenario. Then, we locate Data section and check Get required from input data check-box.

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

Back in the Flow Designer we select our Show Form step. In the Edit Step window we can see that our Form has two Inputs. First one is for a text-box and we Ignore it. Second one is a Logical (Boolean) variable that will define if our Text-Box input should be required or optional. In this example we set it to Constant ‘True’.

Then, we connect the outcome from the Form step to the End Step. This completes our Flow. We click Debug Flow on the top panel in the Flow Designer to test the Flow.

 

If we try to Submit the Form without providing an input in the Text-Box, we are going to see a validation issue and Form will not be submitted.

Additional Resources