WebSphere Lombardi Edition 7.2 > Modeling processes > Advanced modeling tasks


Configure conditional activities

Conditional activities enable you to model steps which, at run time, are either skipped or performed based on the values of particular process variables. The decision to skip or perform a conditional activity can be made by the runtime user or programmatically, based on scripted rules.

A sample business process definition (BPD) that implements conditional activities is available in [Lombardi_home]\imports\conditional-activity-sample.twx. You can import the sample process application and then review the comments in the wle Conditional Activities BPD to understand how conditional activities work.


Implementing a conditional activity


  1. Open a business process definition (BPD) in the Designer.

  2. In the BPD diagram, click the activity that you want to make conditional.

  3. Click the Condition tab in the properties, and then select the Is Conditional option.

    The activity in the BPD diagram now includes a diamond-shaped icon to indicate that it is conditional.

  4. Select the conditional activity for execution using one of the following options:

    Option Description
    JavaScript Enter JavaScript in the available text box that returns a valid Boolean (true or false) value. If the runtime return value of the supplied script is true, the activity is performed.

    If a script is present in the text box, it overrides any human decision at run time to perform or skip the activity.

    Set selected conditional activities If the Is Conditional option is enabled and no JavaScript is entered in the available text box, the activity is performed only if previously selected. Use the tw.system.process.selectedConditionalActivities property to set selected conditional activities.

    If necessary, you can build a graphical user interface (Coach) that enables end users to select the conditional activities to be performed. The conditional activity sample available in [Lombardi_home]\imports\conditional-activity-sample.twx includes a Coach that demonstrates this type of implementation.

Lombardi Performance Data Warehouse records data that enables you to perform analysis on conditional activities. When a conditional activity is skipped, a tracking point is created with SKIP appended to the name of the skipped activity. A tracking point is created in the Performance Data Warehouse TRACKINGPOINT views each time an activity is skipped. Using this data, you can generate reports to show which activities are skipped and how often those activities are skipped in a process instance.


Use the JavaScript API to manage conditional activities

The following table lists the JavaScript API properties that you can use to find and select conditional activities for runtime execution.

Property Description
tw.system.process.conditionalActivities Finds all conditional activities in a process definition (BPD). Returns a list of items of the ConditionalActivity variable type. You can use this property to construct a Coach that allows end users to select which conditional activities that they want to actually run in the current BPD instance. The conditional activity sample available in [Lombardi_home]\imports\conditional-activity-sample.twx includes a Coach that demonstrates this type of implementation.
tw.system.process.selectedConditionalActivities Returns a list of IDs of the conditional activities that are to be performed at run time. You can set the value of this property by providing a list of conditional activity IDs to be selected. This property also accepts a comma- separated string of IDs, which is the output format from the conditional activity Coach
tw.system.step.isConditionalActivitySelected Enables you to determine if the current step is a conditional activity that has been selected for execution.
tw.system.process.guid Returns a BPD's ID.
tw.system.step.guid Returns the ID of the currently executing step (activity).


System services to implement conditional activities

The System Data toolkit provides ready-to-use services for implementing and managing conditional activities. The primary service, lsw Conditional Activity Selection Coach, provides a sample Coach for selecting conditional activities at run time using a graphical interface.

The System Data toolkit also includes a Coach template for conditional activities named lsw Save Conditional Activity Template Coach. A Coach template for conditional activities is specific to a single process definition. You can have multiple Coach templates per one process definition.

Parent topic: Advanced modeling tasks

+

Search Tips   |   Advanced Search