Upload Image from Webservice

Hi, I've got an entity "EMAIL" that inherits from Image. I want to save an email's attachment to this entity. I already have an external webservice that breaks up an email and gives me the attachment which is an image. What would be the best way to create an EMAIL and link the returned image to it using a microflow? How do I upload an Image from a microflow? Kind Regards Frikkie Chalmers
1 answers

From your description, I understand you have:

*An entity EMAIL, which is a specialization of System.Image.
*An image you want to 'add' to the EMAIL entity.

Since EMAIL is a specialization of System.Image, you should be able to map the image you have directly onto the EMAIL object. (And not create another object with an association to the EMAIL object) The easiest way in that case would be to create a microflow which calls the web service that gives you the image, and then use an XML-to-Domain mapping to map this image to the EMAIL object. (You can define which mapping is used in the web service)

If the image you get from the web service is a System.Image object, it's just a matter of mapping the parameters to their counterparts with the same name on the EMAIL object. (HasContents will be automatically set, and FileID will also be automatically set on creation of the EMAIL object).

If you do not get the image as a System.Image object but as a file, you should map the filename to Name and the contents of the file to Contents. DeleteAfterDownload has default value false, so unless you want the picture to be deleted after it's downloaded, you do not need to touch this attribute.