aarebrot.net Frode's blog on Sharepoint and other stuff

How sloppiness and SPWorkflowTask.AlterTask() could inadvertantly lock your workflow task

Posted on October 19, 2011
VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)

The SPWorkflowTask.AlterTask() method is handy dandy. It allows us to alter task details from outside of the workflow itself. I was using it in a couple of custom task forms I had created to update the task based on some user input. It's pretty simple. You get a reference to the active workflow task item, create a hashtable that you populate with the data you want to change, then use AlterTask() to update the task.

This is pretty much exactly what I was doing, except I threw in an item.Update() after my SPWorkflowTask.AlterTask() call for good measure. I wasn't sure if the AlterTask() actually did an Update() internally so I figured it couldn't possibly hurt, right?