Two different XML mappings overwrite my associations

2
I use two different imported webservices to map objects using an association, say I retrieve all parts for the webservice Audi which it maps to my object Parts with an association to Car object. It gets the usual Parts: seat, engine, chassis. My other webservice retrieves most of the same Parts but for a different Car. Using Find and Create if not found, it links the engine to the Car most recently synchronized, at which point the other Car object does not have a link to the engine Part anymore. My metamodel: Car 0 -> 1 Part How can I make sure that both Car objects can have an engine without renaming it all to audi-engine and ford-engine etc.
asked
2 answers
5

If you have an association like this: Part 1 <|-- 0 Car, then each Part has a reference to at most one (!) Car. So if you have a Part called 'Engine' which has a reference to a Car called 'Audi', and later you set the reference on 'Engine' to a Car called 'Ford', then the reference to 'Audi' is overwritten. Apparently, in your project each Part can refer to multiple Cars, and each Car can refer to multiple Parts, so you should use a reference set instead of a reference.

answered
1

With some outside help I've now fixed it with a custom microflow for saving my XML mapping, it does the following:

The XML Mapping sends the Car object and Part name to my microflow. There I retrieve the Part from the database with the follow constraints:

[Car_retail.Part_Car = $XMLMappingParameter]
[Name = $Name]

First it checks if the associated Car object matches the one the XML Mapping gives. Then it checks that the Part name matches the Name I get from the XML mapping.

If this returns something, it sends the ExistingPart through. If not it creates a new Part object and sends that.

answered