Copy Image from One Entity to Another

0
🔹 Use Case: In my Mendix application, I have an entity called Legend_Icon that contains an image (stored as a specialization of System.Image). I want to copy this image file and assign it to another entity called Legend_Symbol, which also contains an image attribute or association. 🔹 Constraints: I do not want to use deepClone or DuplicateImageDocument, as it throws errors like NullPointerException when the target is null. The image from Legend_Icon needs to be physically duplicated, not just referenced, so it remains available even if the original Legend_Icon is deleted. 🔹 Issue Faced: The DuplicateImageDocument Java action fails when the clone target is not initialized beforehand. There are also limitations with deep cloning and generalizations. I initially tried using native microflow actions, but Mendix microflows do not allow copying actual file content, only object references. 🔹 What I Need: A safe and reliable way to copy image content from Legend_Icon to Legend_Symbol
asked
2 answers
0

I understand that you don't want to use DuplicateImageDocument because you might get errors when you have a null target, but I still feel like this is your best option. If you want to make sure you don't throw any errors, do some empty checks to make sure that neither the source nor the target can be null, and that should solve your issue.

 

Also be sure to add proper error handling, though that's always recommended for java actions either way.

answered
0

You can use community common you can  download it from marketplace

 

image.png

answered