Property getting promoted with null or empty value

Today, I was looking into an issue where a property was getting promoted with a null value though we were expecting property to not get promoted as the element was not present in the input message. Due to this, our subscription criteria at the Send Port of Property exists matched and the message was routed to this Send Port. Our business logic was that whenever that element exists in the input message and property gets promoted, then only Send Port needs to subscribe to it. But due to the null value getting promoted, whenever element was not present in the input message, our business logic failed.

The interesting thing was that on another BizTalk environment , whenever that element was not present in the input message, property was not getting promoted and hence subscription worked as expected. One difference I could find out between these two environments,  was that where it worked as expected was BizTalk 2006 R2 and other where it promoted null values was BizTalk 2006. I am not sure if there is a change in behavior on promoted properties between BizTalk 2006 and BizTalk 2006 R2.

Searching on internet, I found https://support.microsoft.com/kb/942250 which says, “Properties that have a null value are not permitted in the message context. Therefore, if a null value is written into the message context, this value will be deleted.” So definitely promoting null values is not expected and may be, this could be a bug with BizTalk 2006.

We needed to have a quick workaround as there was some other testing which depends on it. Now I tried adding a filter with a blank value <empty string> as below.

Untitled

But when I clicked Apply, it threw error: “The filter expression statement element is missing the value attribute”

image

So it means that I cannot add a filter on a blank value or empty string.

But surprisingly, there was a easy workaround. Just put a space in the Value and there we go, we were able to Apply the filter successfully. And it worked too, i.e. it didn’t subscribed to the messages with null promoted property.

Untitled

I still need to find out why it promoted null values at the first place or if it is a bug with BizTalk 2006. Will update this blog post if I am able to find out any further information on it.