Question

I'm writing an SP 2010 custom workflow in VS 2010. In working through the sample found here (http://msdn.microsoft.com/en-us/library/hh824675(v=office.14).aspx). I've run into the bug with OnTaskCreated (http://support.microsoft.com/kb/970548) ... even though the post is SP Services 3.0 the bug still seems to exist for SP 2010. The workaround was to create a good 'ol event receiver in Visual Studio; now all is working great.

This got me thinking that maybe I should have just built the whole thing using event receivers in the first place! What am I missing? What do VS workflows for SharePoint offer that VS event receivers lack?

Was it helpful?

Solution

Event receivers lack state. A workflow doesn't just fire once. It is stared, has some events that are fired, but they represent a sequence of actions that are all fired and that act on some state specific to the lifetime of the whole workflow. With event receivers there is no state. If you want a series of event receivers to logically represent a stateful workflow you need to explicitly create a list or other external storage medium that can represent that state.

(Note this is the most important conceptual difference; obviously there are any number of lower level differences on an implementation, rather than conceptual, level.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top