How to turn on Logging for the Dynamic Connector

Sometimes you need to look at the logs of the connector because the initial error is not very descriptive and you need a few more clues.

The logs are held in an unusual folder – ProgramData, which is often hidden from browsing, so you often have to paste the folder into windows explorer.

below are the steps to start the logging and where to find the file.

You may have problems editing the Microsoft.Dynamics.Integration.Service.exe.config file and the way around this is to copy the file to another folder, make the change and then copy it back and overwrite the original.

You can get this log following these steps:

  1. Stop the Connector service
  2. Go to C:\ProgramData\Microsoft Dynamics\Connector for Microsoft Dynamics\Logs
  3. Rename the following file (new name is not important): Microsoft.Dynamics.Integration.Service.log
  4. Open the following file in Notepad: C:\Program Files (x86)\Microsoft Dynamics\Microsoft Dynamics Adapter\Microsoft.Dynamics.Integration.Service.exe.config
  5. Locate the following parameter: “Microsoft.Dynamics.Integration.TraceLog”
  6. Set the value for this parm to: 4
  7. Start the Connector service
  8. Reproduce the error
  9. read the log file C:\ProgramData\Microsoft Dynamics\Connector\Microsoft.Dynamics.Integration.Service.log

Dynamic Connector – Client Hanging when viewing log files

I had a frustrating few hours this morning when the Dynamic Connector client kept freezing, not responding before finally crashing.

I seemed to be getting the error when trying to view the log files for some of the maps.

I tried installing the Dynamic Connector on another server and I was getting the same error.

The solution to the problem (in my case) was fairly straight forward but logical.


deleting all of the Exceptions in the MapExecptions table in the MSDI database

I also deleted all the values from the Logs table as well (for good measure)

Then I re-launched the client and things were good again.

obviously be aware that if you delete the Logs table you won’t have any logs (but I can usually rack up a load pretty quickly)

Dynamic Connector works with CRM 2011 and NAV 2013

Good news the Dynamic Connector or the Connector for Microsoft Dynamics team are keeping up the good work and development on the Dynamic Connector and already have it working with NAV 2013.

I will first add I think the Connector team need to use a better name than Connector for Microsoft Dynamics because that name makes it very difficult to search for help and we need all the help we can get when using the Dynamic Connector.

The way I search for things is type the name of the software and then the question but the name they are using makes it impossible and extremely difficult to find any help.

on a positive note I think the Dynamic Connector (I’m sticking with that name now) have put a lot more effort and development this year.

  • they have written more useful blog posts
  • put videos on the blog showing how to upgrade
  • improved the functionality (filtering)
  • fixed a load of bugs in the connector

but you still have some way to go because I upgraded the connector the other week and it totally fell apart and couldn’t read half of the maps and I still haven’t installed the connector without problems.

Dynamic Connector – Web service connection errors

A few weeks ago I was getting errors connecting to the NAV webservices using the Connector.

You can read more about that here

I got round the problem by using the ip address of the server, other things you can try is the full name (usually .local at the end or something like that) or just the server or localhost if you are on the machine.

I did raise the question with the Dynamic Connector development team, who are a helpful bunch.

I have had a problem like this before and I thought I would explain what is causing this problem because you may come up agaisn’t similar issues like this in CRM, NAV and the Dynamic Connector.

The basic problem is Kerberos authentication and it’s failing.

the way I understand it is you can access the NAV webservices/crm webservices within internet explorer because you can add the webservices as a trusted site.   Adding this into the trusted sites helps the kerboros authentication, which explains why you can often access it using internet explorer.

If you can’t get any other url’s (ip address, localhost, servername, full servername) then you are going to have look at the SPN settings (Service Principal Settings).

If like me you are not sure what a SPN is, this is probably the time you start to talking to the IT experts internally and on the customer site.

I found a quick explanation about what an SPN is here

A service principal name (SPN) is the name by which a client uniquely identifies an instance of a service. If you install multiple instances of a service on computers throughout a forest, each instance must have its own SPN. A given service instance can have multiple SPNs if there are multiple names that clients might use for authentication. For example, an SPN always includes the name of the host computer on which the service instance is running, so a service instance might register an SPN for each name or alias of its host. For more information about SPN format and composing a unique SPN, see Name Formats for Unique SPNs.

Before the Kerberos authentication service can use an SPN to authenticate a service, the SPN must be registered on the account object that the service instance uses to log on. A given SPN can be registered on only one account. For Win32 services, a service installer specifies the logon account when an instance of the service is installed. The installer then composes the SPNs and writes them as a property of the account object in Active Directory Domain Services. If the logon account of a service instance changes, the SPNs must be re-registered under the new account. For more information, see How a Service Registers its SPNs.

When a client wants to connect to a service, it locates an instance of the service, composes an SPN for that instance, connects to the service, and presents the SPN for the service to authenticate. For more information, see How Clients Compose a Service’s SPN.


My basic understanding of this is you are setting up exe’s and computers to be trusted and put into a sort of list, so when a connection is attempted e.g. from the connector to a computer then if it’s on the list the kerboros authentication works.  Now my explanation could be a load of nonsense buts that how I imagine it works.

This issues are always tricky to resolve because often the IT staff won’t want to get involved and say it’s a problem with NAV/CRM/Dynamic Connector and it’s nothing to do with the IT setup.  It’s highly likely you won’t have access to the domain controller to be able to tinker with the SPN settings so you haven’t really got any choice but to keep explaining to the IT staff.

I have had days wasted trying to figure out these kind of problems and I hope your connector installations don’t suffer from this problem.


Dynamic Connector – mapping OptionStrings in NAV to Optionsets in CRM

Firstly the article post below by the connector team was extremely useful, even if it took me a while to understand where they were putting the values because they didn’t have any screen shots.  I hope the connector team write some more blog posts because the Dynamic Connector users need all the help and documentation we can get.  The article below is exactly the kind of information which should be in a manual or wiki or at least written about a year ago and is the type of information which should be shared to help people get up and running with the connector.  whilst I am asking for the things, top of the list should be for the Dynamic Connector to have it’s own forum or if it has tell me about it.

Below shows my adventure mapping an OptionString in NAV to an OptionSet in CRM, which is harder than it sounds.

Field in NAV

Correspondence Type


Hard Copy





I created a new field in CRM called

NAV Correspondence Type





So as we can see they basically have the same values

For the Contact to NAV Contact Card below is the code I had to put in.  basically a blank is shown in NAV as “_blank_”, so if the optionSet was blank in CRM (e.g. “”) I would put “_blank_”.  For some reason the values came through from NAV with an underscore e.g. Hard_Copy.

=If(EqualTo(NAV Correspondence Type\Name, “”), “_blank_”, NAV Correspondence Type\Name)


Going the other way – NAV Contact Card to Contact

The NAV Correspondence Type is hidden down the bottom.  It has a name and a value but we only want to use Name because we don’t have any way to match the values.

For this code I check to see if it’s “_blank_” and if it is just pass nothing “” otherwise we copy the name value across

 =If(EqualTo(Correspondence Type, “_blank_”), “”, Correspondence Type)

I also wanted to map a two options field in CRM to a checkbox in NAV.

In CRM the values are true and false and in NAV the values are Yes and No, they are close but not close enough to automatically map.  I have a feeling there could be an easier way to do this but I couldn’t find any dynamic examples, only hard coding examples.

NAV field

Exclude from Segment


CRM Exclude from Segment


The contact to NAV contact is shown on a picture above but here is the code

=If(EqualTo(CRM Exclude From Segment, “true”), “Yes”, “No”)


NAV Contact to Contact

=If(EqualTo(Exclude from Segment, “Yes”), true, false)


CRM 2011 – Dynamic Connector Filtering is a great new feature

Version 2 of the Connector for Microsoft Dynamics (I’m still not convinced about this name, it seems to long to me).

has a great new piece of functionality. Filtering makes upgrading worthwhile alone.

There are some other good things in V2 like the fact it installs the CRM solution for you, which means all you have
to do now is run the installer.


What is filtering.

When you create a map in the Dynamic Connector (much better name) there is a new section called Filter. In this area
you can specify lots of filters using AND functionality. This means you can now only sync records which pass your
filter criteria.

An example I recently implemented was a user wanted to only sync orders of a certain type. So I added a new dropdown
and the users would set the dropdown to a certain value – Orders in this case.

I then set a filter to only sync orders with the field value set to Orders.
This is powerful functionality and it’s easy to setup and use in the connector.

There are also a number of bug fixes in the connector so I would recommend upgrading.

The connector team have done a good job making the upgrade very easy, all you have to do is run the Connector.MSI
and it will upgrade legacy maps and running connectors.

when you open the connector which has been upgraded you will see there are two sections, CRM and CRM 2011.

The maps should work without you having to make any changes

Dynamic Connector – Excellent Dynamic Connector blog

This is a quick blog post with two aims regarding the Dynamic Connector.

The fist aim is to point you to an excellent resource for the connector.  The blog written by Konstantin is one of the best blogs on the Dynamic Connector (CRM/NAV connector as I still sometimes call it)

He has some great blog posts

The Most useful tool for troubleshooting the connector

How to include in integration custom NAV tables – Step by Step instruction

How to update Production Dynamics Connector from Development environment

Talking about good Connector resources, I should also mention the Microsoft Dynamic Connector blog, which has recently had some good blog posts and videos.

Konstantin also left a comment on one of my connector blog posts which explained something I had wondered about.  When you tick/untick the Synchronise Connector tickbox in NAV (in Marketing Setup)

Codeunit 5150 has property “Single Instance”=Yes, which mean if you run it, it will sit in memory until you close Client.
That is why “Re-activate” Connector function not working from first time properly. Every time, after you modify this particular Codeunit, you need to reopen Client to apply modifications in YOUR client (WebServices should pickup modifications immediately).

CRM/NAV Connector – State Code or status code is invalid

I was getting the error above when trying to add an order in CRM

the reason I was getting this error because I was using the service user to try and add records into CRM 2011.  This won’t work because the service user can only create/modify records using the SDK.

This is a new edition to the Connector for Microsoft Dynamics, so watch out.

Also once you have set the service user you cannot unset him easily.  You can change this but I’m afraid you are moving into the realms of unsupported changes.

if you try to change the service user by running the CRM configuration utility again with a different user you will set up two users who can’t create orders and yes I did find this out the hard way.

Basically there is a field on the SystemUserBase table called IsIntegrationUser .

When a user is used to run the CRM config utility it will set this value to true and assign the user the Dynamic Integration security role.

To unset you a user you need to set the IsIntegrationUser field to false

as an alternative and much safer method you could show the field on the user form and then set the value on there.

Once you have done this you can then sign in as that user and start using CRM again.

This is all well documented in the installation guide but for those of you who haven’t read it for a while it’s well worth remembering.

Don’t use your CRM user to run the CRM config utility in the connector

CRM/NAV Connector – Crm Exception: Message: entity doesn’t contain attribute with Name = ‘name’

I have had two very frustrating days wrestling with the connector or to call it by its proper name the Connector for Microsoft Dynamics.

I was trying to map Jobs to Contracts, this worked fine, a bit of tinkering to work out what values I needed to put into Contract template lookups but this is to be expected.

I then wanted to map Job Planning Lines to Contract lines.

initially when I put in Job Planning Lines the form in NAV had a header record.  This meant that I couldn’t generate a 1 to 1 mapping between Job Planning Lines and Contract lines because the header would be one record and the individual planning lines would be child records.

Eventually to get round this I put in the form as

Job Planning Line Subform

This is the child form on the Job Planning Line form, so it excluded the header.

I then ran the Connector config utility for NAV but because I had run it before it now doubled up and I had Integration Job Planning Lines and Integration Job Planning Lines Subform.

I also did something similar in CRM and ended up with duplicates for Contracts and Contract lines.

I’m not entirely sure why this happens but its very annoying.

In the end I had to delete the maps which are held in here and will be held with the name of the organisation/company you are mapping


C:\Program Files (x86)\Microsoft Dynamics\Microsoft Dynamics Adapter\Adapters\Microsoft.Dynamics.Integration.Adapters.Nav2009\ObjectConfig


C:\Program Files (x86)\Microsoft Dynamics\Microsoft Dynamics Adapter\Adapters\Microsoft.Dynamics.Integration.Adapters.Crm2011\ObjectConfig

I then ran the config utilities again and the duplicates were removed.  I have no idea why this happens but it happens a lot and is quite annoying.

I then tried to map the Job planning lines and the contract lines now I had a one to one relationship.

I was getting this odd error

>Crm Exception: Message: ‘Contract’ entity doesn’t contain attribute with Name = ‘name’., ErrorCode: -2147217149

The reason I was getting this error is because I think the connector defaults it’s fetchXML to assume their is always a field called name.  Contract unlikely for me changed this to be title.

This just didn’t work and I could find any information on the subject until I finally found this forum

Some excellent person found a solution, I also got some help from Konstantin Levchenko who has an excellent CRM/NAV Connector blog, have a look

to get this to work I had to create a plugin which intercepts the fetchXML by catching RequestMultiples and then change the FetchXml to not use Name but to use DynamicsIntegrationKey and then it works.  This seems a crazy situation and why haven’t Microsoft written this as a plugin within instructions on how to do it.

       public void Execute(IServiceProvider serviceProvider)
            // Obtain the execution context from the service provider.
            Microsoft.Xrm.Sdk.IPluginExecutionContext context = (Microsoft.Xrm.Sdk.IPluginExecutionContext)

           if (context.PrimaryEntityName.Contains("<prefixforCustomEntities>")) //Replace with your prefix

                tracingService.Trace("in the if statement");
                if (context.InputParameters.Contains(("Query")))

                    QueryExpression query = (QueryExpression)context.InputParameters["Query"]; ;
                    FilterExpression fexp = query.Criteria;
                    foreach (ConditionExpression condition in fexp.Conditions)
                        if (condition.AttributeName == "name")
                            condition.AttributeName = "dynamics_integrationkey";



I also had another odd thing was the owninguser field had to be filled in and I had to put in a guid.
I had to go and look up the guid for my user
I’m not sure why it makes me do this whilst other entities allow you to use a lookup.

CRM/NAV Connector – How to map a custom table not included in the standard maps

If you use the connector regularly you will eventually want to map a custom table which isn’t covered by the standard maps.  To do this in CRM side is easy, you run the configuration utility and add the new entity but to do this in NAV requires a bit more work.

The connector works (as I understand it) by publishing tables/pages using a web service which is used by the connector to pass information from and to NAV.

The connector catches these web service calls in the code unit 5150 – intergration management.  If you were to open this up you would see the tables used by the standard maps mentioned.

So I am going to run through the process of adding Job to the custom maps.

First I open NAV and the correct database and company.  Then

Tools –> Object Designer  –> Codeunit –> 5150 –> Design

The first function you need to change is called


You can see from the screen shot below I have also added in Site Address but that was just because I needed to do that, it’s not related to adding the Job table.

You need to copy one of the lines above,  paste it into the list and then change the details so you are referencing the Job table e.g.

If you are not sure what to add and you are adding something other than a Job then the first value is the Form Name and the second value is the table name, so if you were adding Job Planning lines then it would be

  SetupWebServicePages(FORM::”Job Planning Lines”,DATABASE::”Job Planning Line”);



The next function you have to change is called SetupIntegrationTables, you will need to add a new line for each table.

You might wonder why Job is not in double quotes.  Double quotes are needed if the table name has a space in it, otherwise you can just put the table name in.

The next function we need to change is IsIntegrationRecord, you add a reference to the table you want to add.  This function basically tells the connector you want the table to be added to the connector.

Be careful about adding  a comma if the row isn’t the last value

You have finished with the code changes, close the codeunit and press yes to save and make sure the compiled checkbox is ticked.

You now need to refresh the integration webservices so your new table is added and you do this by unchecking and checking the Enable Connector checkbox which is held in Marketing Setup.

You access the Marketing Setup by going to

Administration –> Application Setup –> Sales & Marketing –> Marketing Setup


Untick the box, check the tickbox.  After a bit of time you should see a new integration Web Service added to the list.

You can check this by going to

Administration –> IT Administration –> General Setup –> Web Services

You can see that the page is published and the new Integration Job Card Web Service is running.

Don’t panic if the Job Web Service doesn’t appear, first I would give it a bit of time.  I would try a good old close the NAV client down and open it again (this doesn’t really do anything but it will keep you busy for 30 seconds).

Finally if you don’t see the Web Service go back and check the code changes you have made, look for spelling mistakes, putting in the form name instead of the table name, missing comma.  The problem is going to be a syntax problem.

The final part of the puzzle is too run the NAV configuration utility in the Connector and tick the new Job Card entity


Open the Connector for Microsoft Dynamics

Adapter Settings –> Configure Microsoft Dynamics NAV –> Next –> fill in login details –> select Company –> tick Job Card

I think you might want to just enable the Job Card or the custom entity of your choice only on a specific integration.

hopefully the walk through above should help people add custom entities