Microsoft Dynamics 365 Blog

In Dynamics NAV it is possible to have multiple companies that have similar names. This is because Company Name is not a primary key. Person contacts may be assigned to one of the two companies. If one of these contacts is updated from Outlook, the person contact could be assigned to the other similar named company.

Let’s consider the following scenario:


As you can see, The Cannon Group PLC exists two times. If we create a new person contact and assign this to the second The Cannon Group PLC (CT000142), the picture would look like this:


After synchronization all contacts to Microsoft Outlook, it may sometimes be necessary to update one of the contacts from Outlook. If this is done for the Marco Mels user (CT000143), then after synchronization, the picture would look like this:


The reason for this issue is described below:

When something is modified from the Outlook side, the information sent by the Outlook Add-In to Dynamics NAV contains all the fields of the changed entry, not only the changed ones. On Dynamics NAV side, there is no validation that checks whether a field has changed or not. Therefore, it  updates all the fields that have been sent by Outlook Add-In for a given entry.  The company contact is mapped as a linked relation based to Company Name which is not a primary key. Dynamics NAV receives the Company Name from Microsoft Outlook. The update follows the condition definition and finds the first company with the given company name and uses this one to update the company ID. It can happen that this is the wrong one causing all sorts of incorrect behavior.

In order to fix this there are 3 options:

1) Enforce a unique key on the company name. In this particular name have the customer use a sort of convention for companies that have the same name, something like My Company (Berlin), My Company (Hamburg) … so that names are unique
2) Only modify contacts from Dynamics NAV
3) Add Company No. to the CONT_SP so that the Company No. makes the linked relation unique



To do so, start up the Dynamics NAV client and select Administration, Application Setup, Microsoft Office Outlook Integration, Outlook Synch Entities, press F5 in Code field and select CONT_PERS. Now select Synch. Entity and select Fields. Add a new line and ensure field 50151 is selected and press OK. Furthermore, select User-Defined and save the changes. Do not forget to register the changes in the Change Log!

Drawbacks of this approach:

1) If they want to move a contact to a different company, you need to remember to change the Company No. as well
2) If you want to create a new contact in Outlook, you also need to add the number


Marco Mels

This posting is provided "AS IS" with no warranties, and confers no rights

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!