You have to use a Java action. Please note that a
System.Image object differs from a
System.FileDocument (from which it derives). To copy the file of a
System.FileDocument instance, follow the steps written by Johan den Haan.
However, uploading an image has the following advantage over uploading a
System.FileDocument. While uploading an image, also a thumbnail is created from the image. So if you copy the image, also a new thumbnail must be created. Therefore, don’t use the method
Core.storeFileDocumentContent(...) to store a
In case of a
System.Image file, use the following steps:
Core.getFileDocumentContent(IMendixObject fileDocument) with object A as argument. This method returns an
Core.storeImageDocumentContent(IContext context, IMendixObject imageDocument, InputStream inputStream, int thumbnailWidth, int thumbnailHeight). Put object B in the imageDocument parameter and put the returned
InputStream from the previous method call in the inputstream parameter of this method. Put the width and height you want for the thumbnail in the last two parameters.
After executing your microflow and this Java action, A and B are full copies of each other and deleting object A does not influence anything of object B.