Dynamics CRM and NAV integration using NAV web services

Recently we implemented a project where Dynamics CRM and Dynamics NAV were integrated. The purpose of this integration was to post customer data from CRM to NAV when a new customer is created in CRM or when an existing customer is updated in CRM.

Everything worked smoothly in our testing except the use case of updating customer information from CRM to NAV. Every time the update was tried, NAV web service returned an error as following:

Other user has modified “Contact_Card” “No.=CONST(K25092)”

All kinds of troubleshooting steps were taken to try to find a solution for this. Eventually I ran into this discussion thread:

https://community.dynamics.com/nav/f/34/t/128589

Even though it was a bit different scenario from ours, this was the one that led us to the correct path in finding the solution. It seems that in NAV, there are certain internal processes that get triggered after a record is initially created. These processes apparently make some updates to the record in NAV and due to that, the record is updated every time after the creation event originated in CRM.

Furthermore, our integration logic using the NAV web service was such which did not always fetch the latest version from NAV before sending the update request to NAV web service. Instead, the logic used the NAV customer object details saved to CRM in update request. These details are returned by NAV web service as response values after a successful creation event. The details contain Navision ID and Navision Key as shown below:

 

The combination of these two field values were used as an update key in the update request from CRM to NAV with the end result as explained above, the error.

Once the integration logic was changed to always fetch a latest version of NAV object first before making the update request, the updates started working as well.

It seemed that in this case, the attempt to avoid the one web service round trip from CRM to NAV was the underlying reason for the issue. Luckily there was quite informative error message passed back from NAV web service which led us to the path of solution. Not too many hits though with that error message in the wonderful world of internet so that’s why we decided to publish this tiny little blog post if it helps someone else to resolve such an issue in similar situation.


Read more: https://cloudriven.fi/en/cloud-nine/