Dynamic Update from Host Sample

Download sample

This sample demonstrates how to dynamically update a workflow instance from outside the workflow, that is, from the host program.

The workflow is designed to receive a purchase order request of some amount. This workflow has a CreditCheck DelayActivity activity followed by a POCreated CodeActivity activity. However, because of unusual circumstances, all purchase order requests must be denied. The host performs a dynamic update to remove the purchase order creation step to deny all purchase order requests. This dynamic change is performed outside the workflow from the host.

A more realistic scenario of an unanticipated event that requires denial of all purchase order requests is for the host to issue a Suspend request for all running instances, and then perform a dynamic update to the instances.

In this sample, the unanticipated scenario is contrived by the presence of a CreditCheck DelayActivity activity that gives the host the opportunity to handle the WorkflowIdled event somewhere in the workflow instance.

When you build and run the sample, your output will appear similar to the following:

Output from Dynamic Update from Host sample

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the DynamicUpdateFromHost\bin\debug folder (or the DynamicUpdateFromHost\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also

Reference

RuleDefinitions
RuleConditionCollection
RuleExpressionCondition
ApplyWorkflowChanges
WorkflowChanges

Other Resources

Using Dynamic Updates in Workflows
Applying Dynamic Updates to Workflows
Dynamic Update Samples
Dynamic Update from Host Sample
Dynamic Updates to Rule Conditions

© 2007 Microsoft Corporation. All rights reserved.