Running Flow Actions from a RuleLast Updated: 08/09/2016 Introduced in Verision: 2.0
Rules evaluate a data input and return an outcome that is dependent on whether the input satisfies the rule’s conditions. Action Rules define specific actions (or flows) that will be run in either case, as opposed to the more typical True or False outcomes that are outputted by logical rules.
To create an action rule in the Rule Designer, change the Rule Type in the Properties panel to Action Rule. The structure of the rule statement in the Text Rule View will update with new syntax for defining the actions that will be taken as a result of the conditions being satisfied or not.
Our example begins with the assumption that the folder Designer Folder contains two flows: Admin Flow and NonAdmin Flow. These flows will send a Admin and NonAdmin pop-up notification. Our new action rule will test whether a given email address contains the “admin@.” If it does, the flow Admin Flow will run. If it does not, the flow NonAdmin Flow will run. These two flows simply send a notification noting the flow name to show which flow was initiated.
In the Rule Designer, change the Output Rule Type from Logical Rule to Action Rule. This tells our rule that it should return an action (or flow) rather than a logical construct like True or False.
Next, define input for our rule by clicking the orange Add New button.
In the resulting Entity Select pop-up, we will select the type String and click OK to close the pop-up.
With our input data so defined, click OK to preserve the definition.
The first change seen as a result of our new rule type is the addition of new syntax in the Text Rule View tab. The Then > Execute and Then > Else Execute anchors are where the actions to occur as a result of evaluating this rule are defined.
The first part of the rule is the condition against which inputs will be evaluated. Build this condition by clicking the “If” (Add) icon and selecting Add Condition.
Our rule will evaluate the input defined earlier – EmailID – to see if it contains the string “admin@.” Therefore, our condition will include the input anchor EmailID, the operator Contains and the value “admin@.”
Next, add the actions which will result from our rule. For Then > Execute, hover over the select (Add).
In the event that an email address does not satisfy our condition, we want to run the Non-admin user flow; For Then > Else Execute select (Add) , and select NonAdmin Flow from the list of available flows.
This completes our action rule. Save the rule, and run it in the debugger.
At the prompt, provide an email address. Enter the email address.
The rule evaluates the email as satisfying the rule’s condition, and then run the flow Admin Flow.
If we supply the debugger with the email address not containing “admin@,” notice the NonAdmin flow is called.