Creating an Interpreted Transition

To create a conditional transition, you need to use Gateway: Conditionally split/join flows based on data to link one activity to two or more activities. (You can also define multiple conditions for the same activity by using multiple Gateways).

To define a simple conditional transition:

Procedure

  1. Create the activities
Create two activities Activity1 and Activity2, which Activity0 can optionally move to depending on the condition fulfilled.
  2. Select the conditional gateway
Next, select Gateway: Conditionally split/join flows based on data from the Palette and place it between Activity0 and Activity1 and Activity2.
  3. Create conditions for the activity
Now create two conditions for Activity0 - to move to Activity1 or Activity2, depending on the condition fulfilled:
    • Use a sequence flow to link Activity0 to the Gateway
    • Use a sequence flow to connect the Gateway to Activity 1
    • Use a conditional flow to connect the Gateway to Activity 2.
    • Mark the flow to Activity2 default by selecting it and then selecting the Default option in Sequence Flow in the Properties tab.

  1. Add condition logic
Next, add the condition logic for the non default activity.
    • Select the Sequence flow between Gateway and the non default activity (Activity1 in this case).
    • In the Sequence flow options in the Properties tab, select Conditional.
    • Select Free Text from the Script Defined As dropdown.
      Note: Selecting the Free Text option makes this an interpreted condition. The Java option enables creation of a compiled java transition - for more information refer Compiled Transitions.
    • Manually enter (or cut and paste a previously defined) condition into the Describe Sequence Flow Condition box.

Result

Similarly, you can create multiple conditions, and enter the condition code for each.

Note: The inserted condition has to follow a strict format to be valid. Be careful while entering the expression and double check the validity.

The format of the condition is:

<Rule>
        <Parameter direction="..." type="..." eval="..."         name="...">...</Parameter>
        <Parameter direction="..." eval="..." type="..." name="..."         source="...">...</Parameter>
        ...
        <Condition format="bsh"><![CDATA[ ...</Condition>
</Rule>

Inside the CDATA section, include the java code to be executed. The only requirement is that it needs to have to assign a boolean variable name 'result' a value. This value of this variable will decide whether the transition will be taken or not. The corresponding 'result' parameter must always be present in the Rule tag.