Building Conditional Statements
By default, all workflow operations within Actions, Triggers, and Functions are unconditional, and Alloy Navigator executes them in the order as they appear in the list. To make workflow more flexible, Alloy Navigator supports
IF conditional statements.
For example, using conditional statements enables you to create a Trigger that will generate alert notifications when a poor satisfaction rating is reported, or congratulation messages when the satisfaction rating is high.
INFO: For details on customer satisfaction survey, see The page has been moved.
Each conditional statement establishes a rule where the included operations run only if that rule is satisfied. This rule is called criteria. If the conditional criteria is not satisfied, all operations within the
IF section will be skipped. Adding
ELSE IF and
ELSE sections gives you the ability to specify alternative operations.You can specify criteria with one or multiple conditions joined with logical operators into logical expressions.
INFO: For details on building criteria, see Building Criteria.
Here is an example of basic conditional statement structure:
<Group of workflow operations #1>
ELSE IF and
ELSE statements, you can create conditional statement structure as follows:
<Group of workflow operations #1
ELSE IF (<Criteria2>)
<Group of workflow operations #2
<Group of workflow operations #3
IF...ELSE statement is encountered, Alloy Navigator tests it’s conditions. If first condition is TRUE, the following statements are executed. If first condition is FALSE, each
ELSE IF statement is evaluated in order. When a TRUE
ELSE IF condition is found, the statements immediately following the associated
ELSE IF are executed. If no
ELSE IF condition evaluates to TRUE, or if there are no
ELSE IF statements, the statements following
ELSE are executed. After executing the statements following
ELSE IF, or
ELSE, execution continues with the statement following
Conditional statements can be nested inside other conditional statements and combined with unconditional operations, which enables you to build flexible workflow with complex hierarchical conditions. Here is an example of a nested IF statement:
<Group of workflow operations #1>
<Group of workflow operations #1.1>
<Group of workflow operations #1.2>
<Group of workflow operations #2a>
<Group of workflow operations #2.1>
<Group of workflow operations #2b>
You can add conditional statements to a Function, Action, or Trigger as follows:
- If you already defined an operation which you want to execute on condition, click it.
- Under Operations, click New > "IF" Group. Two rows appear: IF (<Double click to add criteria>) and END IF. The END IF row indicates the end of your IF group.
- To add an ELSE IF group, select the IF line or another ELSE IF line (if already exists) and click New > “ELSE IF” Group. Repeat this step as many times as needed.
- If you want to specify an alternative workflow for situations when neither condition evaluates to True, select the last line before END IF and click New > "ELSE" Group. The ELSE row appears before the END IF row.
- Specify a condition for IF and ELSE IF groups:
- Double-click the IF (<Double click to add criteria>) or ELSE IF (<Double click to add criteria>) row. The Criteria dialog box opens.
- Specify your condition. For details on building conditions, see Building Criteria.
IMPORTANT: For a “Custom SQL Criterion” condition, the SQL expression must refer to objects that exist in the database by the runtime of your Action or Trigger. You cannot refer to objects being created by a Create Object operation at runtime.
- Repeat these steps for other ELSE IF groups (if any).
- Add conditional workflow operations:
- Select the IF ([Criteria]) or ELSE IF ([Criteria]) row and add operations that will run when the condition evaluates to TRUE. Repeat this step for other ELSE IF groups (if any).
- If the
ELSEgroup exists, select the ELSE row and add the alternative workflow operations that will run when the condition evaluates to FALSE.
INFO: For details on adding workflow operations, see Adding Operations.
- Click OK to save the conditional statement.
NOTE: You may want to add comments to
your conditional workflow operationsto indicate what those operations do. For instructions, see Adding Comments.
If you want to modify a conditional statement, double-click it, make your changes using the Criteria dialog box, and save it.
When the operation list contains many conditional groups, you can collapse a group by clicking the minus (-) icon next to its conditional statement, as illustrated below. To expand a collapsed group, click the plus (+) icon. To expand or collapse all groups, click Expand All or Collapse All.
You can copy, delete, or move conditional statements up or down using the Copy / Paste commands available in the pop-up menu and the Delete, Move Up, and Move Down buttons.
NOTE: When you copy or delete conditional statements, workflow operations specified for those statements stay unchanged. To copy or delete workflow operations, do it one by one.