I know I’ve already mentioned Correlation Tokens in an earlier posting last week, but they’re a bit of an animal and I thought I’d try and explain – more for my own benefit – the what how why where of them.
The way a workflow works is that, only a single instance of the workflow is created by the WF host.
All running instances of that workflow share that instance. This has serious implications of how workflows work (known as think threading).
What you have to consider is, how the hell does WF keep the WF straight, if multiple WF instances, share the same WF instance? The answer is, by using CorrelationTokens.
CorrelationTokens is what will let the WF host identify, what activity wants to do what in which workflow.
There are 3 kinds of CorrelationTokens – WorkfFlow, Task, and Modification Correlation Tokens.
Workflow Tokens will apply to the following activities -OnWorkflowActivated, OnWorkflowItemChanged, OnWorkflowItemDeleted, SetState, SendEmail and UpdateAllTasks.
Task Tokens will apply to the following activities -CreateTask, CreateTaskWithContentType, UpdateTask, DeleteTask, CompleteTask, RollBackTask, OnTaskChanged, OnTaskDeleted and OnTaskCreated.Modification Tokens will apply to the following activities -EnableWorkflowModification, OnWorkflowModified.