Add a Condition to a Transition
A transition specifies which step should be executed after a step ends.
By default, as soon as the actions in a step have been completed, the workflow will follow the transition and start processing the actions in the next step immediately.
It is often necessary to make a transition conditional, or in other words, to prevent the transition from being followed until some condition is met.
You can make a transition conditional using either an event or an IF condition:
-
Event: Prevent a transition from being followed until a single specified event occurs. As soon as that event occurs, the transition will be followed and the second step will be processed.
Any event can be used. For a summary of available events, see below.
Show exampleIn the workflow below, the transition to Step 2 will only occur when a particular screen element (Search_Button) is clicked. If this event never occurs, Step 2 will never be processed.
-
IF condition: Prevent a transition from being followed until a specified IF condition is met. You can specify compound conditions using AND and OR logic, and by grouping conditions.
Show exampleIn the workflow below, the transition to Step 2 will only be followed when either Var_1 is larger than 10, or both Var_2 and Var_3 are larger than 10. Step 2 will only be processed if and when one of these conditions is met.
Note that you cannot use event parameters to condition transitions.
You can also use events and transitions to control which of multiple transitions exiting a step will be followed.
In the workflow below, two transitions exit Step 1. Both transitions will wait until an event occurs - if the Google Search button is clicked first, the workflow will transition to Step 2, if the I'm Feeling Lucky button is clicked first, the workflow will transition to Step 3.
Note that:
-
You cannot connect multiple transitions to exit from a step unless they are all conditional. (The project is considered legal and can be executed if just one transition is not conditional, but the workflow will always either follow that transition or the flow will be unpredictable.)
Show errorIn the workflow below, no condition has been specified for either transition.
-
You can only specify one event or add one IF control to a transition.
Show error
In the workflow below, the transition is already conditional on the Google Search button being clicked. You cannot drag another event onto the transition.
To make a transition conditional:
-
Click the transition.
-
Drag an event from the Assets Panel into the Builder area.
or
Drag an IF control from under Common Statements into the Builder Area and specify the conditions.
List of Event Types
The events that can be used to make a transition conditional are all listed in the Assets Panel. Examples are listed in the table below:
Event Type |
Example |
---|---|
Events in the Built-In Services |
The Clipboard Changed event is triggered when the contents of the clipboard change.
|
On Change Event |
The On Change event is triggered when the value of the specified variable changes.
|
Events of Complex and List Variables |
The Elapsed Time event of a Timer complex variable is triggered after the specified time elapses.
|
Events of Workflows |
The Ended event is triggered when the workflow ends.
|
Events of Screen Elements |
The Created event is triggered when a button on a web page is first created.
|
Events of Callouts |
The Shown event is triggered when the callout is first displayed.
|