locked
Get value of CorrelationHandle RRS feed

  • Question

  •  have a workflow that is created in code and a variable of type CorrelationHandle gets initialized in one of the activities. this variable is passed around to other activities, and i would like to get value of this variable in one of the activities

    It is possible to get this value ?

    Monday, March 26, 2012 2:28 PM

Answers

  • You can use the CorrelationInitializers property on a messaging activity (Send, Receive, etc) to initialize a new correlation handle to the runtime value of any piece of message data while it is being sent or received.

    You can also have multiple correlation handles in a workflow if you need a single workflow to correlate on multiple pieces of data. After a handle has been initialized, it can be used in one or more later Receive activities.
    Tim

    • Marked as answer by LeoTang Wednesday, April 4, 2012 5:12 AM
    Wednesday, March 28, 2012 10:41 PM

All replies

  • Is this within a workflow service? You should be able to use ReceiveParametersContent.Create to retrieve the correlation data:

    http://msdn.microsoft.com/en-us/library/ee358755.aspx

    Monday, March 26, 2012 7:56 PM
  • Hm. What do you mean get the value of a CorrelationHandle variable?
    Do you just want to know how to pass the correlation handle from one activity to another? Normally Variables and InArguments will let you do this.
    Or are you trying to look inside the CorrelationHandle to find some other information?
    Tim
    Wednesday, March 28, 2012 7:03 AM
  • I am working on a set of activities that would be used inside a workflow service. Some of these activities initialize correlation handle with some data, and then others send the correlation data ( for a future callback) to other systems.

    When the other systems get done with their work, they can call the workflow service with correlationdata in their call. The problem is of extraction of correlation data in one activity that was set by a previous activity so i can send it to other systems.

    I dont have knowledge of correlation data ( it can be dependent on whatever the previous activity was ) , the only gauranteed contract is that it will be a string.


    • Edited by seeker_123 Wednesday, March 28, 2012 1:13 PM
    Wednesday, March 28, 2012 1:12 PM
  • You can use the CorrelationInitializers property on a messaging activity (Send, Receive, etc) to initialize a new correlation handle to the runtime value of any piece of message data while it is being sent or received.

    You can also have multiple correlation handles in a workflow if you need a single workflow to correlate on multiple pieces of data. After a handle has been initialized, it can be used in one or more later Receive activities.
    Tim

    • Marked as answer by LeoTang Wednesday, April 4, 2012 5:12 AM
    Wednesday, March 28, 2012 10:41 PM