Friday, July 25, 2008

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

Yet another mysterious error I'm still researching. For my complex MOSS workflow with InfoPath forms, I do the following:
  1. Remove Workflow from associated list.
  2. Remove corresponding feature from entire farm (for good measure).
  3. Clean and rebuild entire workflow solution.
  4. Deploy workflow.
  5. Start the workflow on an existing item in associated list.
  6. Fill out the initiation form (that was built via InfoPath and VSTA).
  7. Get an error screen saying: "The workflow failed to start due to an internal error" (even though I have set every bloomin' Web.config file on the server to NOT show custom errors and TO show a call stack).
  8. I return to the associated list.
  9. *le gasp* The item says its workflow is "Completed" despite the error!
  10. I check on the status of the completed workflow, and see it has created 1 task (after which it was supposed to wait for that task to be updated or completed, infopath form and all, after which it was supposed to assign another task).
  11. I click on the task, then on "Edit Item", then "OK".
  12. I repeat step 11, but this time when I click "OK", I get the error message "This task is currently locked by a running workflow and cannot be edited."
Yet the Workflow has completed. Hmmm...

I know I made an error somewhere (probably failed to correctly include a Form for the tasks or something), but geez, some uncontradictory information would be helpful!

Stay tuned for a solution (if I ever find one! :P).

EDIT: I think I resolved this by setting TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160" in my workflow.xml. This is what you use if you do NOT define a content type in SP first (as is the case with this workflow). Evidently, this ID is universally recognized as the code for custom content schemas defined by attached InfoPath forms with URN's corresponding to those found in the MetaData section of Workflow.xml. In other words, all tasks with TaskProperties.TaskType=X will have ExtendedProperties corresponding to the InfoPath form whose URN == TaskX_FormURN.

Please respond with any corrections to any misunderstandings of mine. Thanks!

1 comment:

podescrermeu said...

Have you discovered the solution for your 12th step?