Associating a Script with a Conditional Flow

Scripts are associated with a Conditional Sequence Flow by entering the script in the Properties view for that Sequence Flow object. You can use a script to define the conditions that determine whether a conditional sequence flow is followed. At runtime, this causes the Sequence Flow to be followed only if the condition is met.

Procedure

  1. Create the Conditional Sequence Flow object. On the General tab of the Properties view, note that the Conditional button is selected.
  2. In the Script Defined As list, select JavaScript.
  3. Enter the script in the Describe Sequence Flow Condition area. The script can be a multi-line script and the result of the last statement of the script should be of boolean type and that determines the result of the script. This is an example of a simple script:

    This is an example of a more complex script:

    The Describe Sequence Flow Condition area supports the usual text editing assistance such as color syntax highlighting, content assist and error markers (see Implementing Script Tasks for more information).

    Note: On the General tab, there may already be a text description of the required script. This description will be converted to comments if you select JavaScript from the Script Defined As list. If you select Unspecified from the Script Defined As list, the description is lost. You can however recover the description by pressing Ctrl + Z.