Running Flow Actions From A Rule
- Updated on 09 May 2013
- 3 minutes to read
Rules evaluate a data input and can be configured to 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, 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 an Admin and NonAdmin popup notification. Our new action rule will test whether a given email address contains the string 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 .
Name the new rule Action Rule and click OK .
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 link.
In the Object Editor popup, name our data input EmailID .
To define our input data type, click the Type selector, located directly underneath the Name input. String is selected by default. In the resulting Entity Select popup, we will select the type String and click OK to close the popup. With our input data 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 that will represent our rule results. For Then > Execute , hover select ( Add) .
In the event that an email address satisfies our condition, we want to run the Admin Flow flow, therefore, select Admin Flow from the list of available flows.
In the event that an email address does not satisfy our condition, we want to run the Non Admin flow. For Then > Else Execute select ( Add) , and then select Non Admin 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@ the NonAdmin flow is executed.