XML Mapping of ArrayItems

When your webservice returns an ArrayItem, it creates two domain entities to map to. This creates two instances of the entity, as can be seen below: How can I map this correctly in one go so that it maps everything to the same instance?
2 answers

You could "find by microflow", and then return the same object each time.


I think in this case you might want to consider making a 'transfer' entity to which one of the two entities to be mapped is mapped (The other can still map to the Company entity). Afterwards you could then call a microflow to also map the attributes from this transfer entity to the actual target entity.

So for your above screenshot for example:

  • Map RPT's attributes to company.
  • Map ArrayOfstringItem's content string to 'TransferEntity' (you can of course pick a name yourself) which is associated to the corresponding Company object and is created during the mapping.
  • Call a microflow in which you use a Change Object activity to set the attribute corresponding to the ArrayOfstringItem contents using the 'TransferEntity' object.

To make things a bit easier in matching the TransferEntity object with the corresponding Company object, you could put an association between the two so that you can easily retrieve them in the microflow. (And after setting the Company attribute you can then delete the TransferEntity object which is no longer needed for anything.

A way you could do the microflow is to have it retrieve all the Company objects which were mapped to by the XML mapping, and then loop over these, retrieving the corresponding TransferEntity object, setting the Company attribute in a Change Object activity and then delete the TransferEntity object.

(If you have no way to check which Company objects were written to by the web service, you can just loop over all Company objects and after trying to retrieve the corresponding TransferEntity object, check if it's not empty in an exclusive split, and if it is empty just use a continue event to go to the next Company. Assuming you delete the TransferEntity objects after use this way you will only write to those Company objects which were just mapped to)