BizTalk Server Orchestration error: There is no value associated with the property in the message

In some BizTalk solutions, we have the need to access some properties that were promoted to the context of the messages in the receive pipelines inside the Orchestrations. We can access default native property promotions or custom property promotions by doing the following sample expressions:

PortName = MyMessage(BTS.ReceivePortName);  
MyFileName = MyMessage(FILE.ReceivedFileName);  
MySubject = MyMessage(POP3.Subject);  
MyCustomProperty = MyMessage(MyPropertyPromotionNamespace.PropertySchema.ID);

But while I was doing that to access an EDI property, I got the following error:

Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘MyOrchestrations.D96A_Orders(8925ca53-20e8-8960-8ef3-b1c88cd46d8a)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 948996b6-f612-4ae2-9668-035183855656
Shape name: Construct OrderExtendedProp Msg
ShapeId: 40b80329-0eb4-417b-9205-6d3ff0626306
Exception thrown from: segment 1, progress 7
Inner exception: There is no value associated with the property ‘EDI.UNB3_2’ in the message.

Cause

One of the disadvantages of trying to access property promotions inside Orchestration is that you need to ensure that they exist. Otherwise, you will get this exact error. That means, for some reason, this property you are trying to access inside your Orchestrations does not exist in the context of the message.

In my case, I was trying to read UNB 2.3 EDI property inside the orchestration:

varUNB32 = msgOrder(EDI.UNB3_2);

However, the EDI file didn’t have the proper UNB 3.2 setup, so it was not promoted inside the receive pipeline.

Solution

When you try to access Promoted properties inside the Orchestrations, to avoid these types of errors, you should check if the Promoted property exists before trying to read it by using the exits operator.

//GET UNB3.2
if(EDI.UNB3_2 exists msgOrder)
{
   varUNB32 = msgOrder(EDI.UNB3_2);
}
else{
   varUNB32 = "";
}

The exists operator tests for the existence of a message context property in a certain message and returns a true or false. It can be used in Expression, Message Assign, or Decision Shapes.

Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top