Setting preconditions for ad hoc activities

You can specify preconditions that must be met before the activity is ready to start. Activities can start automatically after all the preconditions are met or manually by a user after all the preconditions are met. If you do not set any preconditions, automatic activities start as soon as the process is started and manual activities must be started by a user.

About this task

A precondition consists of two parts, a precondition event, and a precondition expression. The two parts together determine when the activity starts:
  • If both are defined, then when the precondition event occurs, the precondition expression is evaluated. If the expression evaluates to true, the activity starts.
  • If there is a precondition event but no precondition expression, the activity starts when the precondition event is met.
Note: In addition to determining when the activity first starts, the precondition also determines when an activity that is already started changes state. For example, from a waiting state to a working state. See Runtime states for activities in process applications.

Procedure

To set a precondition:

  1. Open the process.
  2. In the process editor, switch to Definition, and select the ad hoc activity that you want.
  3. Switch to the Preconditions tab.
  4. In the Precondition Event section, select the event that triggers the precondition expression to be evaluated.
    Precondition event Description
    No precondition event for this activity Automatic activities start as soon as the process is started. Manual activities must be started by a user.
    A document is filed in the process For this event to start an activity, you must select a folder and then the document types from that folder. First, select the Folder Type, which provides two ways of specifying a folder.
    Managed
    Shows folders that you defined on the Folders tab. For example, Root Process Folder and any folder that you defined under it.
    External
    Shows folders for external ECM systems or in the IBM® BPM content store. The external ECM servers are the servers that are specified in the Servers tab of the Process App Settings page. The Folder Path can contain either a static path to a folder or a JavaScript expression, which can link dynamically at run time to any external folder. See Selecting IBM BPM or an external ECM system to manage folders.

    Next, you select your document types from the folder.

    All
    The activity starts when a document that matches any document type in the folder is filed into the folder.
    Selected types
    The activity starts when a document that matches any of the document types that you select is filed into the folder.

    The activity starts automatically if the activity was set to start automatically. The activity is ready to be started if the activity was set to start manually.

    Inside the implementation of the activity, you can use JavaScript. The JavaScript can access the identifiers of the document that caused the activity to start and the name of the ECM server where it is located. You can use these identifiers to further process the document within the activity by using Enterprise Content Management operations.
    tw.system.currentAdHocActivityInstance.enablingDocumentID
    tw.system.currentAdHocActivityInstance.enablingDocumentServerName
    A process property or variable is updated You can select multiple process properties or variables from the list provided. The activity starts when any of the specified properties or variables are updated.
    A precondition expression is met There is no precondition event to be triggered. You must specify a precondition expression, and when the expression is met, the activity starts.
    1. Click the + icon in the Precondition Expression section heading.
    2. Specify the parameters of the expression. For example, you might specify claimAmount is greater than 100. You can specify multiple expressions for the precondition. For example, you might specify creditCardNumber is not equal to 0 and vendorName is not like Unknown.
    3. Select Match All if both expressions must evaluate to true for the activity to start. Select Match Any if the activity can start when any one expression evaluates to true.
  5. Click Save or IBM BPM version 8570 cumulative fix 2017.03Finish Editing.