SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write a workflow which creates and updates tasks when the workflow item is changed. For example: the workflow-item has a multivalue field with users who should approve the workflow-item:

  1. When the item is created, the workflow has to create a task for each approver
  2. When the workflow-item is changed the workflow has to change the description of every task.

Part 1 (creation of multiple tasks) is more or less easy: I used a replicator activity (an example for this can be found in

Part 2 (updating all tasks which were created in Part 1) is difficult:

I tried to write a CodeActivity, which iterates through all tasks and changes them via AlterTask-calls. This works perfect for the first time, but if I try to alter the same task a second time I get an exception, because the workflow has locked the task.

Another idea was to change the tasks with an UpdateTaskActivity. But this is difficult, because I have an arbitrary number of tasks and cannot define the right CorrelationToken for the UpdateTaskActivity.

Does anyone know a solution for this?

share|improve this question

To prevent the error "This task is currently locked by a running workflow." try setting the WorkflowVersion of the task item to 1.


private void ResestTask(SPListItem task)
    // Remove the error "This task is currently locked by a running workflow."
    task[SPBuiltInFieldId.WorkflowVersion] = 1;

    // Update the task fields for example:
    task["Status"] = "In Progress";
share|improve this answer

Your Answer


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.