Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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

share|improve this answer
up vote 0 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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