Entries in BizTalk Mapping (2)


Microsoft Dynamics AIF Error, missing class attribute

Came across a rather annoying issue that caused a few people to scratch their heads. We were integrating with AX using BizTalk and sending in a standard SalesOrder message but it kept failing with the following error:

Error:    The class AxSalesTableInterface does not support or does not have a parmSalesLineInterface method.
Error: Data source SalesPrice not in query AxdSalesOrderInterface.

After some sole searching we remembered that within the BizTalk map we had to use some custom XSLT to deal with some aggregation.

<xsl:template name="f_GiftLineItems">
<xsl:param name="totalLines" />
<xsl:param name="index" />

<xsl:if test="1 = ($index)">
<xsl:element name="ns0:SalesLineInterface">
<xsl:element name="ns0:ItemId">GIFT1</xsl:element>

<xsl:element name="ns0:SalesPrice">
<xsl:value-of select="userCSharp:MathRound(sum(//*[local-name()='Detail']/@GiftWrapPrice),'2')"/>

<xsl:element name="ns0:QtyReserved">1</xsl:element>

<xsl:element name="ns0:SalesLineInterface">
<xsl:element name="ns0:ItemId">SHIP6</xsl:element>

<xsl:element name="ns0:SalesPrice">
<xsl:value-of select="userCSharp:MathRound(sum(//*[local-name()='Detail']/@ShippingPrice),'2')"/>

<xsl:element name="ns0:QtyReserved">1</xsl:element>


The SalesLineInterface has an attribute called class that is required and must contain the string “entity”. The BizTalk mapper will normally add the attribute for us but as we’d used the Script Functoid we have to explicitly add it.  Easy to miss and can take a while to work out what’s going on. The class attribute is present on all “table” records in the AIF message and needs to be there.


<xsl:element name="ns0:SalesLineInterface">
<xsl:attribute name="class"><xsl:text>entity</xsl:text></xsl:attribute>

Generating the ExtensionObject XML

If you’re looking to call .NET assemblies or functoids from within custom XSLT you’ll need to get the extension object xml. You can get this from the SDK but the easiest way is setup the map with a script functoid referencing the assembly. Validate the map and you’ll get a nice link to the ExtensionObject XML. Create a copy and reference it the map and away you go.