The “Generate mapping” regenerate the mapping from staging to target.
When we click on “Generate mapping” we have two possibility:
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):
Here we have the mapping BEFORE the “Generate mapping from modifications”:
Here we have the mapping AFTER the “Generate mapping from modifications”:
The 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:
In this way we haven’t anymore duplicates.