Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 356
Leon Bouquiet Avatar asked Sep 11 '15 19:09

Leon Bouquiet


2 Answers

I have also seen where you have to have both the relationship, and both fields defined the mapping in the solution in order for the mappings to be exported... So if I have Entity A that has a Mapping to B, for fields A.1 to B.1 and A.2 to B.2, I have to make sure that the relationship, and fields A.1, A.2, B.1 and B.2 have been added to the solution as well, or else they don't get exported.

Update

After some further testing, in order for Lookup Attributes to be included in the Export of a Mapping, the Target Attribute field MUST BE included in the solution!

like image 68
Daryl Avatar answered Oct 29 '22 10:10

Daryl


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.

like image 20
Leon Bouquiet Avatar answered Oct 29 '22 11:10

Leon Bouquiet