Running Flow Actions from a Rule

Last 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.

Example

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.

From the Designer Folder, begin by clicking the Create Rule button, and selecting Create Rule
createRule
 
 
Name the new rule “Action Rule” and click Create.
 nameRule
 

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.

RuleDefineInput Screenshot

In the resulting Object Editor pop-up, name our data input “EmailID.”
 
RuleDefineInput2.0 Screenshot 
 
To define our input’s data type, click the Type selector, located directly underneath the Name input.
 
RuleTypeButton Screenshot

In the resulting Entity Select pop-up, we will select the type String and click OK to close the pop-up.

RulePickType

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.

 

 IfThenTextView

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.

 

 addConditionIf

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@.”

 

 emailIdContainsAdmin

Next, add the actions which will result from our rule. For Then > Execute, hover over the select (Add).

 

 pickAdminFlow
 
 
 
In the event that an email address satisfies our condition, run the Admin Flow flow, therefore select Admin Flow from the list of available flows.
 
 adminFlowSelected

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.

TestRule Screenshot

At the prompt, provide an email address. Enter the email address.

 runDebugInputs

The rule evaluates the email as satisfying the rule’s condition, and then run the flow Admin Flow.

 

 result

If we supply the debugger with the email address not containing “admin@,” notice the NonAdmin flow is called.

 

Additional Resources