Running a Flow for Complex Evaluation within a Rule

Last Updated: 08/09/2016 Introduced in Verision: 2.0
The rule engine supplies nearly all the rule verbs you will need, however some cases require custom complex verbs. In this situation, the rule engine allows users to define their own verbs. These “custom verbs” are actually flows that can be called from within a rule. The example below will demonstrate how to use this advanced flow verb.
This example will demonstrate how to use the advanced flow verb to evaluate if a list of numbers added together is greater than 10.
Since we know that we need a custom verb we will begin by writing this verb (flow) before beginning to write the rule. Create a new flow named Is Number List Sum Greater Than 10 Flow
Click on the Start step and add the following input data: Number List (Int32, is list)


Now we need to fill in the logic of this flow so that it compares the sum of our Number List to Number to Compare. If the Sum is greater than the Number to Compare we should return True. Otherwise we should return False.
In the Toolbox, navigate to Data > Numbers and drag Sum onto your canvas.


Now click on the Sum step to configure its properties. Select Number List for values.


In the Toolbox, navigate to Data > Numbers and drag Greater Than onto your canvas.
Click on the Greater Than step to configure its properties. Set value1 to Sum1_Output and value2 to 10.
Click on the End step to edit its properties. Click Add in the Output > Data section. Enter Result for output data name and Boolean for Data type. Click Save.
Set the Display Name of this end step to be True, and set the value of Result to be True (checked).
Click copy, then paste to make a copy of this end step.
Click on the second end step and set the Display Name to be False, and set the value of Result to be False (unchecked).
From the Greater Than step, connect the True path to the True End Step and the False path to the False End Step
Your flow is now ready to be used as an advanced verb in a rule. Save and close your flow.
Create a new rule named Is Number list greater than 10.
Click Add New Under Flow Data > Flow Input Data. Enter Number List for Name, Int32 for Type and check Is List. Click Save.
Click Add New Rule Step button.
Select Number List and click Next.
Select Advanced > Evaluate and click Next
Select your flow and click Done.
Your rule is now ready to test. Click Debug Rule.
*Note in Decisions 3.5 Debug Rule is renamed Test Rule
TestRule Screenshot
Enter 5 and 8 for Number List and click Run without Save.
If you have configured your rule and flow correctly, you will see that the rule debugger has returned True.

Additional Resources