@michaelLipscombe 

Entries in Microsoft Dynamics (1)

Tuesday
Aug092011

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>

<xsl:element name="ns0:QtyReserved">1</xsl:element>
</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>

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

</xsl:if>
</xsl:template>

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>