Platform SDK: Exchange Server

Creating a Process Instance

A new item arriving in the folder is the primary event that creates a new process or advances the state of an executing process. When the engine's OnMessageCreated event fires, the engine tries to correlate the new message to one of the existing process instances being executed. If the item is successfully correlated to a process instance, the state of that process is updated and the engine executes the next step in that process's map.

If the new item does not correlate to any existing process instance, a new process instance is created. To accomplish this, the engine performs several steps to transform the new item into a process instance:

  1. A new item arrives in a monitored folder.
  2. The routing engine inspects the item for an existing Map property. If it has no map, the default map installed in the folder is attached to the item as a new property. If the item has its own map, the default map is not attached, and an ad-hoc process definition (see the following section About Ad-hoc Processes) is submitted for the new WorkItem.
  3. The routing engine gives the item a number of new properties that make it a full-fledged process instance, including current status, a unique routing ID number, and so on. The WorkItem has now been transformed into a Process Instance Message (PIM).

The following diagram summarizes how the routing engine creates a new Process Instance Message (PIM):

About Ad-hoc Processes

A newly arrived item in a monitored folder can contain its own process map. A Microsoft Outlook custom form, for example, could use routing objects from within its script to create a map on a new item. When posted to the folder, the map on the new WorkItem is used instead of the default map for the folder. In this case, an "ad-hoc" process is said to have been defined for the item.

Executing the Process Map

When a new Process Instance Message is created, the engine begins executing the first activity in the PIM's map. If the activity calls for custom (VBScript) actions, the functions are found in the script that has been installed in the folder. Normally, this script consists of the default VBScript actions (see Script Actions) provided with Microsoft Exchange routing objects, but it could also be a customized version of these commands or even a totally new set of custom commands.

Execution of the map continues sequentially until it terminates. The execution sequence is controlled by the use of flow-control-oriented Intrinsic Actions.