During package install, package mapping fails with an exception message: “An item with the same key has already been added”.
Before patch 188.8.131.52, a defect in Global Values Lists (GVL) caused them to change to Custom Values Lists on save. All the Values Lists (VL) fields using the GVL are also affected by this change and are corrupted.
Packaging a module containing the corrupted VL field will have the mapping issue.
Restoring GVL which changed to Custom Values List fixes the Values Lists. Steps to do this are as follows:
SELECT ft2.select_name as GVL, ft.field_name as FieldName, mt.module_name as Module FROM dbo.tblIVFieldDef f JOIN dbo.tblIVFieldDefValueList fd ON f.field_id = fd.field_id JOIN dbo.tblFieldTranslation AS ft ON fd.field_id = ft.field_id JOIN dbo.tblXIVSelectDefFieldDef sdfd ON fd.field_id = sdfd.field_id JOIN dbo.tblIVSelectDef sd ON sd.select_id = sdfd.select_id JOIN dbo.tblIVSelectDefTranslation as ft2 ON ft2.select_id = sd.select_id JOIN dbo.tblModuleTranslation as mt ON mt.module_id = f.module_id WHERE f.active = 1 and sd.select_def_type_id = 0 and ft.language_id = 1 and ft2.language_id = 1 and mt.language_id = 1 and sd.select_id in ( select sdfd1.select_id from dbo.tblXIVSelectDefFieldDef sdfd1 group by sdfd1.select_id having count(sdfd1.select_id) > 1 ) and sd.alias <> f.Alias;
Please run the above script in the source instance database where the package is generated. Results contain GVL - GVL that needs to be restored, FieldName - corrupted Values Lists using the GVL, Module – Module containing the Values List.
Each GVL may be used by multiple VL fields. We need to take an action only once per GVL. So, select any one field (from FieldName column) in the list per GVL and open it’s Manage Field page.
For example, it typically looks like the above screenshots. Notice that the Name and Values List fields have different values and Promote to Global Values List link is enabled.
The text under Values List should match the data in the GVL column from the script. In the above example, the text is ‘GVL’.
Once confirmed by the previous step that the Values List is corrupted, click on the Promote to Global Values List link. This restores the GVL and changes all the Values Lists using it back to Global.
Perform these steps for all GVLs in the results returned by the discovery script.
Discard the old package and generate a new package in the source instance. The new package can be mapped and will not throw an error.