Correlation within BizTalk

 Uncategorized  Comments Off on Correlation within BizTalk
Oct 102014

I wanted to write about something that is sometimes mis understood regarding correlation sets.

A lot of samples I have seen have the same data being correlated on, symptoms or it is named the same, medicine etc.

I am going to show that those are not requirements though.

I created a purchase order schema


I also created an Acknowledgement Schema


Now I want to be able to correlate off of the purchase order number, treat but notice that they are not named the same, nor are they even the same type (one is an element, the other is an attribute. The only real thing that needs to be the same is the same data type (string, or int, or whatever; in this case they are both strings)

So I create a property schema and call the value PurchaseOrderNumber, that I set to MessageContextPropertyBase (I always do this so that if one of the messages doesn’t have a element, it can still be assigned to the message), and also to show that the property schema property name doesn’t have to match either of the schema defined elements/attributes.

So now I go back into each of the schemas and add a new property to each of the schemas, I add the reference to the schema, and then click Add and PurchaseOrderNumber shows up in the drop down



Now I create the Orchestration and create a new CorrelationType


And then Add the POMsg and AckMsg and the CorrelationType to get this:


Now I create my send shape to send out the Purchase Order initializing the correlation set


And add the following correlation set to the receive shape



A few notes:

  • This does not need to happen at the beginning of the orchestration
  • Generally I have an expression that sets the value of the property ex: POMsg(BizTalk_Server_Project1.PurchaseOrderNumber)=”123”;