Easy Promotion of Context Properties

Abstract: I’ve been dealing with context properties, and I’ve discovered a couple of very useful tricks for promoting and routing.

some definitions:
As you’ll probably know, there are two types of properties in the context of a message: properties based on field values (MessageDataPropertyBase) and properties not based on fields (MessageContextPropertyBased). I’ll call the first ones Message Properties and the other ones Context Properties.

Message Properties based on message fields are automatically written and promoted into message context by BizTalk.
Context Properties not based on message fields can be assigned inside an orchestration using the expression Message(Property) = “value”;
One of the most interesting stuff about Context Properties is that are not tied to a concrete schema, so they can be used regardless the message type. A sample of a system context property is FILE.ReceivedFilename.

the problem of promoting context properties:
When you create a context property, not based on a message field, and you assign a value inside an orchestration, it is written, but not promoted. What does it means? it means that you cannot route the message based on this property.
Some days ago I had the situation where needed exactly this: content based routing based on a custom context property that had a value calculated inside an orchestration.

A common solution is to create a custom pipeline component that writes and promotes properties. Jon Flanders has created a good generic component to do this: the ContextAdder Pipeline Component.

the trick:
In my case, the pipeline solution is not an option, since I’m routing between orchestrations via Direct Port Binding. Also, coding a custom component to promote a property seems to complex for me…
Somebody told me a good trick to promote context properties inside an orchestration, easy and direct:
Create a CorrelationSet based on the property.
Even if you are not going to use it, when you initialize a CorrelationSet, the Orchestration engine makes the promotion of the properties involved, since correlation is just an special kind of routing.

So now I have some dummy CorrelationSets, that I call <Property>Promote_CorrelationSet

nice and easy! 🙂

Comments (18)
  1. Amit Chawla says:

    Would send ports subscribe to properties promoted in such a way?

    I have a similar situation, but want the message to be subscribed by the send port NOT another orchestration.

    Any Ideas?


  2. Cristian Sobral says:

    I’ve tried this today and works for both, orchestartions and send ports.

  3. John says:

    Cool stuff David!

    How I can defined the CorrelationSet inside the loop. I need in each iteration to create a new one, Any ideas?

  4. Jukka Laaksonen says:

    I had the same problem.

    I solved it calling an other orchestration inside the loop. The called orchestration can initialize the correlation set.

  5. rick says:

    unless i’m missing something, the problem with this method is that if you have two different orchs where you want to init a corr set based on the same property…you will get an error on build, corr may be initialized only once, which makes sense.  

    is there some way around this, without doing a custom pipe?  thx.

  6. chrishan says:


    I tried this method with BTS2006 beta2 I created a dummy correlation set only with one context property -InterchangeID. It doesn’t get promoted. It works if I promote it in the pipeline.

    Any clue?

  7. Suneet says:

    Great trick… thats what I was looking for exactly… Thanks.

  8. Raj says:

    I have created a custom adapter in VB .Net for receiving file. In the orchestration later I want to send a file with the same name as received. How can I do that?

  9. Prasanna Krishnan says:

    Just one little thing, if you have multiple fields in your correlationset then you need to initialize all the variables, it took me half a day to figure out why it was failing

    Anyway thanks for the simple trip, saved me creating custom pipeline

  10. Ben Szymkow says:

    Thanks. The correlation promotion trick worked well for me. I was needing to route based on FILE.ReceivedFileName which does seemingly not get promoted by default.

    I created a dummy Correlation Set/Type and set the send port to initialize it and the process worked swimmingly.


    Ben Szymkow

  11. BizUser says:

    I’m getting the error when doing the following.

    Error is in very last of this message.

    I added a new element in PropertySchema and set the PropertySchemaBase to MessageContextPropertyBase.

    Then I created a dummy CorrelationSet and select the element which I created in PropertySchema as a CorrelationProperty (only one element in the CorrelationSet)

    Then In my first receive shape in odx, I’m initializing the newly created correlation set.  

    what I’m trying to do is retrieve the first part of the File.ReceiveFileName and assing its value to the property.

    ReceivedFilePrefix = MessageRequestFromTPA(FILE.ReceivedFileName);


    Then in the very end, I’m sending a message to a Direct Port (MessageBox)

    MessageResponse(solutionname.PropertySchema.ReceivedFilePrefix) = ReceivedFilePrfix.

    In the SendPort in MMC I filter the newly created property.  

    solution Built fine and deployed.

    but I’m getting an error as soon as it hit the first receive shap in odx where I’m initializting the correlation set:


    Inner exception: Failed to initialize the correlation property name: ReceivedFilePrefix namespace: http://ProjectName.PropertySchema.PropertySchema from message: MessageRequestFromTPA.

  12. Ashwani says:

    Great post. Helped my cause a great deal.

  13. Hi Dave,

    Thanks for the post, you just saved me 😉

    Finally after wasting a day for this, but always glad to find a solution in the end 😉

  14. Romie says:

    I couldn’t get this to work in 06 either. I’m using BTS06 R2. Guess I’ll try the pipeline method!

  15. Property Promotion inside Orchestration

  16. Property Promotion inside Orchestration

Comments are closed.

Skip to main content