Import Mapping creates missing objects twice when there are duplicate keys in imported sub-items

0
Hi. One of my sub-entities is associated with a root entity both directly and via an intermediate entity: In JSON the key of this intermediate entity is mentioned twice: first time in an array element in the root object property and second time as an associated parent object: [ { "Iden": 0, "Attribute": "string", "SubItems": [ { "Iden": 0, "Attribute": "string" } ], "SubSubItems": [ { "Iden": 0, "Attribute": "string", "SubItem": { "Iden": 0 } } ] } ] In my Import Mapping in all mappings I selected “Find an object (by key)”:   However, when I import the JSON above to an empty database the SubItem object is created twice. I even tried to replace the built-in search with a microflow that searches by association instead of database, but it seems that at the time of the second search all the attributes and the associations of the new objects are not set. Here’s the Github repo with the project: https://github.com/basi01/testimportmapping
asked
1 answers
0

The Find an object action looks into your table, but finds nothing, because your data is not committed (still in memory, not in database). That’s why you can have duplicates after commit.

This issue is also possible if you have already data in your tables: if id 1 is more times in your data to import, but this id is not in the mapped field of your table.

————————

A solution could be to handle the find action by a microflow. In that case you also can find both in the non-committed list and in database.

 

answered