Using Conditions and Switch Steps in Processes
Conditions and switch steps can be used in processes to enable dynamic decision making within the processes.
Each connection, except that from the Start step, has a conditional flag. The conditional flag enables you to set a condition on a connection. The condition refers to the processing status of the originating step. Possible flag conditions are:
|Success||The process completed successfully. When set, the connection is green.|
|Failure||The process did not finish successfully. When set, the connection is red.|
|Always||Accept either status. When set, the connection is gray.|
By default, all connections have the flag selected, meaning the originating step must successfully end processing before the target step starts processing.
To change a flag's value, select the connection and cycle through possible values by clicking the flag. You can also select the value in Properties.
Process with Switch Step
A switch step is a utility step that enables you to branch a process based on the value of a property.
The following figure illustrates a switch
step. In this example, the switch property is
version.name. The connections from the switch
step represent process branches depending on the value of
version.name. In this example, regardless of
which branch is taken after the switch, the process converges to the
Run WLDeploy step.
Run WLDeploy has success and fail conditions. See
Deployment Automation Plugins
for more information.
Switch steps are processed as follows:
- If a step has multiple connections that eventually reach the same target step, determining whether the target will execute depends on the value of the intervening flags. If all of the intervening connections have success flags, the target will only process if all the steps are successful. If the intervening connections consist of an assortment of success and fail flags, the target will process the first time one of these connections is used.
- Regular expression matching is used to evaluate the switch step
values. If a value is not a properly-formed regular expression, the step will
fail. For example, if your value is a directory name, such as
C:\temp\store, you must escape the
\to make it a valid regular expression as follows:
- For a process to succeed, execution must reach a Finish step. If it does not end with Finish, the process will fail every time.
Note: By default, Deployment Automation resolves expressions in Set and Switch steps, but you can configure the server so that it doesn't. For details, refer to Knowledge Base item S141763.