3

I have a SharePoint 2010 workflow that creates a task. The task has custom form and custom code executed when the form is submitted.

Inside the code I'm trying to set the Completed Status on the task when some conditions are met:

.....
SPListItem taskItem = this.workflowProperties.TaskList.GetItemById(...);
taskItem["Status"] = "Completed";
taskItem.Update();
......

I get this error:

This task is currently locked by a running workflow and cannot be edited

There are a lot of hits on this when you do a search and lots of fixes (workarounds?!).

My question is, what's the correct (or by the book) solution for fixing this?

0

This explains it in a clear way, along with the solution : http://blogs.code-counsel.net/Wouter/Lists/Posts/Post.aspx?ID=118

0

I eventually went for adding a UpdateTask activity in my workflow to update the properties I was interested in. It didn't involve any workaround code and I never got the "This task is currently locked by a running workflow and cannot be edited" since then.

  • Hi I'm experiencing the same problem on my production server. Could you kindly explain how to use the 'update task activity' Should I use powershell? and what atribute? Code would help explain. Thanks – Raj Chahal Apr 23 '13 at 7:43
0

There can be many causes for this error, but one of them can be when you have too many tasks in parallel in a single workflow (In my case that is what was happening). This often means that multiple processes are attempting to access a workflow task at the same time. A large workflow has more tasks and more updates in the single workflow, so more chance of causing a lock. Also if a lock does occur, a larger workflow can make it difficult to determine the point at which the lock happened while a smaller workflow will always be easier to diagnose.

But under normal circumstance. it takes time and later it can be processed! successfully!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.