If you know a workflow will have to wait for a response from an outside source during its run, but do not know how long that wait will last, you can implement it as a trigger-based long-running workflow. A trigger-based long-running workflow waits for a defined trigger event to occur before resuming.

You implement a workflow as a trigger-based long-running workflow by using the Waiting Event element. When the trigger-based long-running workflow arrives at the Waiting Event element, it will suspend its run and wait in a passive state until it receives a message from the trigger. During the waiting period, the passive workflow does not consume a thread, but rather the long-running workflow element passes the workflow information to the single thread that monitors all long-running workflows in the server.

Create a workflow.

Open the workflow for editing in the workflow editor.

Add some elements to the workflow schema.

Define a trigger event that is encapsulated in a Trigger object.

1

Drag a Waiting Event element from the Generic menu to the position in the workflow schema at which you want to suspend the workflow's run.

2

Link the Waiting Event element to the elements that precede and follow it in the workflow schema.

The scriptable task that declares the trigger must immediately precede the Waiting Event element.

3

Click the Waiting Event element to show its properties tabs in the bottom half of the Schema tab.

4

Provide a description of the reason for the wait in the Info properties tab.

5

Click the Attributes properties tab.

The trigger.ref parameter appears in the list of attributes.

6

Click the trigger.ref parameter's Not set link to bind the parameter to an appropriate Trigger object.

The Waiting Event selection dialog box opens, presenting a list of possible parameters to which to bind.

7

Select a predefined Trigger object from the proposed list.

This Trigger object represents a trigger event that another workflow or workflow element defines.

8

Define any exception behavior in the Exceptions properties tab.

9

Click Save at the bottom of the workflow editor.

You defined a workflow element that suspends a trigger-based long-running workflow, that waits for a specific trigger event before restarting.

You can run a workflow.