D365 Finance & Operations and Dynamics AX Forum

interCompanyMirror: Bar code does not exist for [ItemId] of type MAIN

  • 1.  interCompanyMirror: Bar code does not exist for [ItemId] of type MAIN

    Posted Feb 11, 2019 01:05 PM
    Hello. I am investigating an issue in our AX 2009 environment with adding sales lines to intercompany sales orders. In the scenario that we are seeing, the user is creating an intercompany sales order and adding a service item (dimension group SERV) as a sales line. The configuration for the SERV dimension group specifies that there are no active item or storage dimensions. A service item is a service we provide, not an actual thing that we keep in stock. At any rate, when the user attempts to save the sales line, the save fails with the following error and stack trace as the result:

    Bar code does not exist for [ItemId] of type MAIN.
    Stack trace:
    (S)\Classes\Global\error 16
    (S)\Classes\XMLAxId2Code\validateXMLCode 31
    (S)\Classes\XMLAxId2Code\new 4
    (S)\Classes\XMLAxId2Code\newXMLMapItemId 3
    (S)\Classes\TradeInterCompanyConv\axSalesItemId 29
    (S)\Classes\SalesLineType\interCompanyMirror 52
    (S)\Classes\SalesLineType\insert 55
    (S)\Data Dictionary\Tables\SalesLine\Methods\Insert 41
    (S)\Classes\xRecord\dbOpInTransaction 0
    (C)\Classes\FormDataSource\write 0
    (C)\Forms\SalesTable\Data Sources\SalesLine\Methods\write 47
    (C)\Classes\FormDataSource\leaveRecord 0
    (C)\Classes\FormRun\selectControl 0

    This stack trace will probably, at some points, vary a bit from what one would see in stock AX 2009, as we have customized our deployment. I have highlighted the lines of interest in the above stack trace. In a nutshell, in the insert() method on SalesLineType, a call to interCompanyMirror is being made that eventually results in the item's bar code being validated. Because this is a service item and will never have a bar code (and in fact can never have one), the error is thrown in line 31 of XMLAxId2Code.validateXMLCode. It may be worth noting that placing the same sales order as a non-intercompany sales order does not result in this error, as SalesLineType.interCompanyMirror never gets called in that scenario.

    My question for the room is this: is there a way to coerce SalesLineType.interCompanyMirror into not validating bar codes for sales lines that are just never going to have them? I want to avoid "fixing" stock AX functionality around this as much as possible, as this seems to be a "deep magic" portion of the application stack. Has anyone else encountered this, and if so, how did they work around it?

    Andrew Matthews
    Cayman Chemical Company
    Ann Arbor MI

If you've found this thread useful, dive deeper into User Group community content by role