MessageContextPropertyBase type field not promoted in message context

Problem:

MessageContextPropertyBase type field is written to the message context but it is not promoted

Scenario Details:

For demo purpose, suppose we have a field “Salary” added to Biztalk PropertySchema where its Property Schema Base is set to MessageContextPropertyBase as shown in below screenshot:

We want salary calculated and assigned inside and orchestration and then have Salary added to the message context of the final output message so that we can later do routing (at send port level) based upon salary value.

However when we are calculating employee salary and assigning it to “Salary” field inside an orchestration and when orchestration finally sends out final message (via send port in it) then we can see “Salary” field appearing in message context but it is showing as “Not Promoted” in message context as shown in below in screenshot:

Since this salary field is “Not Promoted” in message context so our salary based filter at the other send port(s) is not working as intended and hence the solution doesn’t work correctly

Resolution:

It is important to understand that when a value is assigned to a field/element which is added to some PropertySchema and whose Property Schema Base = MessageContextPropertyBase then the value of that field is “written” to the message context (and it surely becomes part of the message context) however that field is NOT promoted inside message context by default and hence, down the line, we can’t do any routing based upon value of this field.

In order to get this field “Promoted” inside message context we need to do following:

  1. Create a new CorrelationType and select desired field of the PropertySchema under Correlation Properties (yellow highlighted in below screenshot):

2. Now create a new Correlation Set based upon the Correlation Type created in previous step

3. Now, inside the orchestration, go to the properties of the send port (whose output message should have desired field in its message context) and initialize newly created correlation set at send port level as shown in below screenshot:

4. Now re-deploy modified/updated orchestration and restart biztalk host instance(s)

5. Execute/invoke newly deployed orchestration and inspect the message context of final output message and this time you will be able to see “Salary” field as a “Promoted” field inside the message context (as shown in below screenshot) and now you will be able to successfully perform send port level routing/filtering using value of the Salary field

Leave a comment