Options

Dynamics CRM Integration - Integration Record for entity Sales Header was not found

TomigsTomigs Member Posts: 85
Dear experts,

We have a system with Dynamics (NAV2016) and Dynamics CRM integration.
I'm running into a problem with the Sales Order sync:
There is a Sales Order in CRM that we are trying to create in NAV. In NAV I go to the CRM Sales Orders page, see the corresponding page and click "Create in Dynamcs NAV". After a while I get the error:
The integration record for entity Sales Header: Order,SO-000416 was not found.


I checked the table 5331 CRM Integration Record, and it is true that the order
Any idea on what is going on or what can I review?

Some more data on the issue:
- NAV2016 (46621). CRM
- From the CRM Sales Order Page, the link to open the order in the CRM works well.
- The CRM Account is coupled with a Customer in NAV and the CRM Product is coupled to a NAV Item too.
- Other areas of the CRM integration work fine, such as the NAV Customer - CRM Account sync.

Thanks,
Tomigs

Best Answer

  • Options
    TomigsTomigs Member Posts: 85
    Answer ✓
    Hi all,

    Just to let you know that this is (hopefully) finally solved for me.

    After <whining starts>quite a lot of tests, iterative work with the objects and the code coverage </end of whining> it turns out that the error was being caused by the Codeunit 1 – ApplicationManagement.

    The problem was that we have this codeunit 1 modified by a 3rd party add-on. This add-on alters certain functions, making its execution subject to the add-on to be configured and other conditions.

    In the Codeunit there are a series of functions that are called whenever a record is inserted, modified, etc (OnDatabaseInsert(), OnDatabaseModify(),). That way they can handle the change log, but more importantly for me, this functions in call also the Integration management.

    For the CRM Sales Orders, inserting an entry into the table 5331 "CRM Integration Record" triggers the insertion of an entry in the table 5151 "Integration Record" (indirectly through the function OnDatabaseInsert() in Codeunit 1 previously mentioned). The add-on added conditions to be met to call the Integration management that blocked it.

    So provisionally we have restored the original codeunit1, that makes free use of the Integration Management codeunit, not subject to the add-on configuration, and it worked for us.

    We will ask the vendor of the add-on the way to fix this properly, either by configuration or modifying those conditions, that in first sight look too restrictive.

    And I correct my last post: the Integration record does not appear "magically" on finding the CRM Integration record, but on the insertion on this, through codeunit 1 and codeunit 5150 Integation Management.

    Regards,
    Tomas

Answers

  • Options
    TomigsTomigs Member Posts: 85
    Hi,

    I'm still fighting against this. I give you an update on this in case someone come with any comment.

    I tried connecting my CRM system to a different NAV database, in a different server. And in that case I had no problem creating the CRM Sales Orders. I don't get the "integration record does not exist" issue, and the sales order is created wonderfully in NAV.

    I tried also connecting my CRM system to a Cronus company in the original (erroring) database, and in this case I get the same "Integration record does not exist" error. I thought that maybe allowing the system to do a default CRM setup in a brand new company would fix it, but it didn't.

    So, it seems that I have something wrong in my database or in my server. I have no problem synching customers, items, etc. But it won't synch sales orders.

    Debugging is not helping so far: I tried to understand at what stage the Integration Record (table5151) is created in the system, comparing the system that works with the one that it does not. It turns out that the integration record entry for the table 36 seem to appear "magically" when the system does a FindRowFromCRMID() (a findfirst of the table 5331 CRM Integration Record). All triggered by the codeunit 5343 Sales CRM Order to Sales Order, in the function InitializeSalesOrderLine() --> InitializeSalesOrderLineFromItem(). Atached diagram of the functions executed.
    Any clue on how these Table 36 Integration Records are created is appreciated.

    3sobl9bj3kme.png


    Thanks,
    Tomas
  • Options
    TomigsTomigs Member Posts: 85
    Answer ✓
    Hi all,

    Just to let you know that this is (hopefully) finally solved for me.

    After <whining starts>quite a lot of tests, iterative work with the objects and the code coverage </end of whining> it turns out that the error was being caused by the Codeunit 1 – ApplicationManagement.

    The problem was that we have this codeunit 1 modified by a 3rd party add-on. This add-on alters certain functions, making its execution subject to the add-on to be configured and other conditions.

    In the Codeunit there are a series of functions that are called whenever a record is inserted, modified, etc (OnDatabaseInsert(), OnDatabaseModify(),). That way they can handle the change log, but more importantly for me, this functions in call also the Integration management.

    For the CRM Sales Orders, inserting an entry into the table 5331 "CRM Integration Record" triggers the insertion of an entry in the table 5151 "Integration Record" (indirectly through the function OnDatabaseInsert() in Codeunit 1 previously mentioned). The add-on added conditions to be met to call the Integration management that blocked it.

    So provisionally we have restored the original codeunit1, that makes free use of the Integration Management codeunit, not subject to the add-on configuration, and it worked for us.

    We will ask the vendor of the add-on the way to fix this properly, either by configuration or modifying those conditions, that in first sight look too restrictive.

    And I correct my last post: the Integration record does not appear "magically" on finding the CRM Integration record, but on the insertion on this, through codeunit 1 and codeunit 5150 Integation Management.

    Regards,
    Tomas
Sign In or Register to comment.