Kirk Evans Blog

.NET From a Markup Perspective

Water Cooler Demo: SharePoint state machine workflows


I’ve posted a new video to Channel9… SharePoint Visual Studio state machine workflows for escalations and timeouts.

After I went through the learning process of creating a set of screencasts focused on SharePoint development, a few things became evident.  I don’t like the name of the series, and I don’t like the lack of any branding.  Further, I really want to do more than just screencasts, I want to do interviews with people on Office development.  I was talking with Brendon Schwartz, and he suggested the name “water cooler”, evoking images of gathering around the water cooler to discuss (even gossip) about things around the office.  Cool idea, Brendon!

Introducing… The Water Cooler Show!

I can’t think of a better way to introduce this series than opening the spigot (wow, I am so going to have fun throwing out bad water puns and references) and showing off how to create a somewhat complex business process using a minimal amount of code and completing the basic functionality within 20 minutes. 

As some background, I’ve see some very unnatural things attempted with Windows Workflow Foundation, using sequential workflows to do things like escalations and timeouts.  You can do it, but it usually involves some nasty workflow acrobatics to achieve the desired end goal.  What I’ve come to understand is that developers can usually grok sequential workflows, but state machines are a little more elusive.  I’ve seen customers using complex ConditionedActivityGroup patterns or Replicator patterns to create a solution that is difficult to learn how to implement the first time, and even more difficult to maintain when you’re not the guy who created it.  In contrast, escalations and timeouts are 2 scenarios that the state machine model in WF make incredibly easy to implement once you understand the basic concepts of how to use the State, SetState, StateInitialization, and EventDriven activities.  Even better, I find that they are more descriptive and easier to maintain.


In the first Water Cooler Demo screencast, we focus on how to build a SharePoint state machine workflow, and demonstrate this with a real-world scenario.  Rather than list the steps to build a workflow here, go watch the screencast video… you’ll be surprised at how little code is written to support this scenario.

Let’s gather around the Water Cooler (yeah, this is going to be fun) and talk about state machine workflows in Office.

For More Information

Building State Machine Document Approval Workflows for SharePoint Server 2007

How Do I: Create a State Machine Workflow for SharePoint?

Developing Workflow Solutions with SharePoint Server 2007 and Windows Workflow Foundation

Developing Workflows in VS: Part 3 – Five Steps for Developing Your Workflow – great information on understanding the correlation token