EDI Override Context Properties

I ran into a small issue when trying to use the EDI override context
properties
in BizTalk inside of a custom ESB service component. I
would assume that this would also apply to custom pipeline components
too. I was trying to override the GS02 value used by a trading partner
as they use two different GS identifiers with the same ISA identifier.
To my knowledge, this is impossible to define in the BizTalk Server 2010
party configuration, so I use the override to choose the correct GS
value as needed.

To make a long story short, when using the override properties, be sure
to set the OverrideEDIHeader property to true. Otherwise the EDI send
pipeline will ignore the override values and use either the configured
party values or the default fallback values.

In my case, this looks like this:

1
2
msg.Context.Write("OverrideEDIHeader", "http://schemas.microsoft.com/BizTalk/2006/edi-properties", true);
msg.Context.Write("GS02", "http://schemas.microsoft.com/BizTalk/2006/edi-properties", overrideGS02);

In the past, I have successfully set the override context properties
inside an orchestration they processed in the EDI send pipeline without
my explicitly setting the OverrideEDIHeader property. I have no idea why
it works that way inside an orchestration and not the same way inside a
pipeline. I just know I wasted a good hour trying to figure out why my
override was not working.