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.
 
Example
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)
 

 addFlowInputData

 
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.
 

 dragSum

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

 numberListAsVal

 
In the Toolbox, navigate to Data > Numbers and drag Greater Than onto your canvas.
 
 dragGreaterThan
Click on the Greater Than step to configure its properties. Set value1 to Sum1_Output and value2 to 10.
 
 inputsToGreaterThan
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.
 
 addBoolOut
Set the Display Name of this end step to be True, and set the value of Result to be True (checked).
 
 resultTrue
Click copy, then paste to make a copy of this end step.
 
 copyPast
Click on the second end step and set the Display Name to be False, and set the value of Result to be False (unchecked).
 
 falseResult
From the Greater Than step, connect the True path to the True End Step and the False path to the False End Step
 
 conectTrueAndFalse
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.
createRule
 
Click Add New Under Flow Data > Flow Input Data. Enter Number List for Name, Int32 for Type and check Is List. Click Save.
 
numberListInt32 
Click Add New Rule Step button.
 addNewRuleStep
 
Select Number List and click Next.
 
 ifNumberList
Select Advanced > Evaluate and click Next
 advancedEvaluate
 
Select your flow and click Done.
 
 pickFlow
Your rule is now ready to test. Click Debug Rule.
*Note in Decisions 3.5 Debug Rule is renamed Test Rule
TestRule Screenshot
 
 debugRule
 
Enter 5 and 8 for Number List and click Run without Save.
 
 
 debugRuleInputs
If you have configured your rule and flow correctly, you will see that the rule debugger has returned True.
debugResult
 

Additional Resources