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.

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

  1. JanetT February 28, 2012 / 4:50 pm

    Thanks for your recent posts regarding the Connector. Been struggling with CRM 2011 Online to Nav for several days and it has been very valuable. I was wondering if you have seen this error before:

    [Project to NAV Job Card] has encountered an error while processing key [71f6c818-4c40-e111-bf19-1cc1de0875ed]. The given key was not present in the dictionary.

    “Project” is a custom CRM Entity and I am trying to sync it to NAV Job Card. I have tried Fiddler but can’t see any error. I have generated by definition several times and done the mappnig several times. The “Project” Entity has about 150 attributes but I am only interested in 5 of the fields for NAV Jobs. I created a “Test Project” entity in CRM of just those 5 fields and created a mapping to NAV Jobs and it works fine. So seems that is is something to do with my Project Entity. Any ideas how I can find the problem as I am truely stuck!


    • Hosk February 28, 2012 / 5:23 pm

      I’m not sure what the problem is

      in your comment you say it maps ok with the 5 fields you are interested in mapping. cool, just map those 5 fields.

      you could add more fields until you find out which field is causing the error.

      also make sure you have downloaded the latest release, there was a hotfix for Connector V2 last week


  2. Konstantin February 29, 2012 / 1:49 am

    Hi Janet,
    Unfortunately I don’t know to how to use Fiddler with CRM Online because it using LiveID instead Windows Account. But here is some thoughts:
    “The given key was not present in the dictionary” is a common CRM error and usually it mean that you trying to use inexisting field. Where exactly error happen in Connector is very difficult to say without fiddler.
    I would suggest to perform next steps:
    – Make sure that Connector Settings is up to date
    – Make sure that CRM Adapter folder not contain duplicates AdapterObjects
    – delete all field in map except mandatory (probably only JobNo)
    – Try to sync one record but before make sure that mapped fields has values

    If it works, start add by one field until catch error again.



  3. dorothyjarry August 17, 2012 / 8:11 pm

    Awesome post. I am linking to your post from a post i did of a very similar issue I was having. I made a couple small changes to the code supplied here. great solution that worked perfectly for something that has been a real PITA for me. Love the connector but it still has some issues that can be tough to over come.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s