dynamics-crmdynamics-crm-2015

Attribute mappings (on N:1 relationships) not included in export?


MS CRM 2015 allows you to specify an attribute mapping on a relationship between entities. E.g. for the "contact_customer_accounts" relation shown below, it defines which attributes from Account should be copied over to the Contact when adding a new Contact via the Account's "related contacts" view.

However, when I change such a mapping (and publish all customizations), it doesn't get exported as part of my solution (or the default solution, for that matter). When I compare the customizations.xml files before and after such a change in mapping, they are (for the relevant parts) exactly the same - this information just doesn't seem part of the export?

I also found the Customization solutions file schema, and it doesn't seem to mention anything about the attribute mappings either.

I'd think that this information should be part of a solution export - does anybody know why it's not?

enter image description here

Update: I imported my solution (with both Account and Contact) in my organization and published. Then removed half of the mappings from the "contact_customer_accounts" relation and published again. Finally imported the same solution and published again: the removed mappings did not return.

So I think it's safe to say that the solution doesn't contain the mapping information.


Solution

  • As Joseph Duty pointed out, the attribute mappings are stored in the customizations.xml file under ImportExportXml/EntityMaps (see the Customization solutions file schema on how to use them). However, when the solution is exported, they don't seem to contain any "system" relations, only relations in which at least one entity is a custom entity. So that's probably why my mapping changes didn't end up in the solution export.

    The good news is that you can add such a mapping by hand to the customizations.xml file, and when imported, you'll see the mapping appear in all relationships between these entities:

    <EntityMaps>
      <EntityMap>
        <EntitySource>account</EntitySource>
        <EntityTarget>contact</EntityTarget>
        <AttributeMaps>
          <AttributeMap>
            <AttributeSource>telephone1</AttributeSource>
            <AttributeTarget>telephone2</AttributeTarget>
          </AttributeMap>
          <AttributeMap>
            <AttributeSource>telephone1</AttributeSource>
            <AttributeTarget>telephone3</AttributeTarget>
          </AttributeMap>
        </AttributeMaps>
      </EntityMap>    
    

    Removing one or more AttributeMap elements from the customizations.xml doesn't cause the corresponding mappings to be removed, but this is regular behavior when working with solutions.