0% found this document useful (0 votes)
63 views2 pages

Windows Workflow Tutorial

A state machine workflow provides a set of states that the workflow transitions through based on events, unlike a sequential workflow which flows linearly from one step to the next. This document discusses using Windows Workflow Foundation to model business processes as either sequential or state machine workflows. It provides an example order processing workflow that could be modeled as either type, with a state machine workflow better able to handle points where the process must pause waiting for external events.

Uploaded by

amit_maity
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

Windows Workflow Tutorial

A state machine workflow provides a set of states that the workflow transitions through based on events, unlike a sequential workflow which flows linearly from one step to the next. This document discusses using Windows Workflow Foundation to model business processes as either sequential or state machine workflows. It provides an example order processing workflow that could be modeled as either type, with a state machine workflow better able to handle points where the process must pause waiting for external events.

Uploaded by

amit_maity
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Windows Workflow Tutorial: Introduction to State Machine Workflows

Introduction

Workflows model business processes. When you design a workflow, your first task is to identify the steps that occur
during the business process. That is true whether the business process is the processing of an order, the calculation
of a bonus payment or the processing of a loan application. The business process consists of steps and your job is to
define those. Once you have the steps defined, you can use Windows Workflow Foundation (WF) to build a
workflow that models the business process.

You can build two types of workflows with WF: sequential and state machine workflows. A sequential
workflow provides a structured series of steps in which one activity leads to another, and steps generally occur
immediately one after another. A step might wait for some event (an email to arrive, for example), but
sequential workflows are often used to model processes that operate without human intervention.

A state machine workflow provides a set of states. The workflow begins in an initial state and ends when it
reaches the completed state. Transitions between the states define the behavior. In general, state machine
workflows react to events. The occurrence of an event causes the workflow to transition to another state.

Whether you build a workflow as a sequential or state machine workflow depends on how the business manages
the process. For example, suppose you need to build a workflow that models processing an order. You
determine the following steps are involved:


The business receives the order, including all necessary information (customer, product, quantity, credit card
information, shipping address, etc).

The business checks if the customer has sufficient credit. If so, the workflow continues. If not, the order is canceled
and the workflow ends.

The business checks if there is sufficient inventory to fulfill the order. If so, the process continues. If not, the order is
canceled and the process ends.

The business asks the credit card company for payment. If the credit card company approves, the process continues.
If not, the order is canceled and the process
ends.

The item ships to the customer. The order is marked as fulfilled and the process ends.

A sequential workflow is likely the appropriate type of workflow here. The workflow starts when the company
receives an order. It then continues through a number of steps until the order is either canceled as fulfilled. The
workflow runs from start to finish with no delays.

As an alternative, suppose you determine the following steps are involved in processing an order:

The business receives the order, including all necessary information (customer, product, quantity, credit card
information, shipping address, etc).

The business checks if the customer has sufficient credit. If so, the process continues. If not, the order is canceled
and the workflow ends.

The business checks if there is sufficient inventory to fulfill the order. If so, the process continues. If not, the order is
canceled and the process ends.

If the product is in stock, the process waits for shipping to ship the product.

Just before shipping the product, the business asks the credit card company for payment. If the credit card company
approves, the process continues. If not, the
order is canceled and the process ends.

After the product ships, the process waits for the customer to acknowledge receiving it. If the product arrives, the
process ends. If the customer does not receive
the product, the process waits for shipping to resend it. At this point, either the business or the customer can cancel
the order, ending the process.

You can successfully implement this business process either as a sequential workflow or as a state machine
workflow. To decide, think about what makes it different from the previous scenario. There are several places in
the business process where the process needs to pause and wait for some other process to begin. The pause may
be short. It may also be long. It could take weeks or months for new inventory to arrive if the product is out of
stock. It hopefully only takes days, not weeks, for shipping to send the product. It will take anywhere from one

You might also like