Step 3: code your workflow
With your data in place, write your workflow logic. It's pretty straightforward, but here are a couple pitfalls that you shocould watch out:
Pitfall: re-using non-serializable SharePoint objects after rehydration
Other non-workflow specific SharePoint objects, like splistitem, are not serializable, so when the workflow dehydrates, these items become invalid. so if you try to use them when the workflow wakes up, you will get an error. to avoid this, refetch items if you're using them after a workflow rehydrates.
Pitfall: Forgetting to make custom classes serializable
When creating your own class in a workflow, don't forget to add the "serializable" attribute to the class. if you don't do this and declare a variable of that class in the workflow's scope, the workflow will fail when it tries to go to sleep and serialize the class. if you notice that the workflow "completes" when it isn' t supposed to, this may be the culprit.
Pitfall: updating locked items
If a document is open or locked, updating the item will throw an exception. if you need a workflow to write to a column on the item, you can try to: a) have the workflow poll for the lock and executing the update only when the lock is released, or B) use item. systemupdate () to "burn through" the lock. note that for option (B), the user who has the document open will blow away the workflow's changes if he saves the document.
FAQ: How do I set a custom status for my workflow?
The SharePoint setstate activity does this. See wss sdk for details.
Next time: deploy and debug your workflow