Microsoft Dynamics AX development

Archive for November, 2016

DIXF: Duplicate mapping after “Generate mapping from modifications”

The “Generate mapping” regenerate the mapping from staging to target.

When we click on “Generate mapping” we have two possibility:

aufnahme1

Generate the mapping from scratch
It means that AX deletes and recreate the mapping. With this options all the (possible) manual modifications are deleted.

Generate the mapping from modifications
It means that AX adds the modifications to the existing mapping and the (possible) manual modifications are preserved. But, with this option we have a problem, if we have overwritten the method “getMappings()”.
AX creates duplicate mappings for those specified in this method.
For example, entity DMFProductEntity.

Method “getMappings” of the class (take into consideration the field AllocateMarkup):

aufnahme6

Here we have the mapping BEFORE the “Generate mapping from modifications”:
aufnahme2

Here we have the mapping AFTER  the “Generate mapping from modifications”:
aufnahme3The problem is that AX does not control if a  mapping already exists for the entity.

The method that duplicates the mappings is on the table DMFTargetXMLToEntityMap.generateMapping(). I’ve found a solution and added the following modification in order to control if the mapping already exists:

aufnahme4

In this way we haven’t anymore duplicates.

 

Advertisements

Tag Cloud