Correlation value on declaration “x” is already initialized

If you’re writing a workflow and are using the CreateTask or CreateTaskWithContentType activities you may come across the following error:

System.InvalidOperationException: Correlation value on declaration “Name of your token” is already initialized

When adding a token to the create task activity you will more than likely have set the OwnerActivityName property of CorrelationToken to the workflow itself.

The create task activity (and subsequent OnTaskCreated, OnTaskChanged and CompleteTask activities) should be contained within a Sequence activity (or a child type) and it is this that should be used for the OwnerActivityName property.

Ensure that all task activities contained in your sequence block use the same correlation token definition.

This entry was posted in SharePoint, Workflow and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve the maths problem shown below before posting: *