Wednesday, 1 April 2009

Unique CorellationToken for each Task activity in WSS workflow

I was strugling with a workflow that the CreateTask did not create a task as expected. After googling around and it turned out that Task-related activities need a unique CorellationToken value.

There are three groups of activities with each group has it's own CorellationToken, and activities with the same group should share the same correlation token:


Workflow token:

OnWorkflowActivated
OnWorkflowItemChanged
OhWorkflowItemDeleted
SetState
SendEmail
UpdateAllTasks


Task token:

CreateTask
CreateTaskWithContentType
UpdateTask
DeleteTask
CompleteTask
RollbackTask
OnTaskChanged
OnTaskDeleted
OnTaskCreated


Modification token:

EnableWorkflowModification
OnWorkflowModified

SharePoint Workflow failed to start

If a workflow is created through a WSPBuilder project, the workflow would have problem to start. To solve this problem, the .csproject file needs to be modified manually. Open the project file in notepad, add the following line

Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets"

right after the line

Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"


Then problem solved.

This is really a frustrating issue.