Hi, this is a personal project of mine. I have an entity with generalization of System.Image, which I use to store Images that users upload through the Image Uploader widget. I want to convert the image (or Contents attribute) into Base64 so that I can use a GET request in Node-Red to retrieve these images through a Published REST Service. As you probably know, the ‘Contents’ attribute of the System.Image entity is stored as a long Binary value, which I can see when I use a GET request. I was thinking whether is it possible to convert this value into a Base64 String, or if there is a better method of getting these Images through the published REST service. I have looked through other forum posts on this matter, but I am still unsure. I have a page where the users upload their images, and I have assigned a microflow to the ‘Save’ button, which previously had the ‘Save Changes’ On click event. This is what the microflow currently looks like. I am using the CommunityCommons module to get the Base64 action. I am unsure of what to do with the return value (ImageBase64) of the ‘Base64 Encode File’ action. I thought of using a ‘Change object’ action and changing the ‘Contents’ attribute of the ‘Image’ object, but there is no option. It would be nice if I could get an example of what the microflow should look like and whether assigning it to this button is right or wrong :)
The return value is the base64 string of your Image entity. So what you want to do is store that value in a String attribute somewhere that can handle that string length. I would just set that string attribute to have Unlimited length. Also the entity that should be passed into your Save microflow should be your entity with the generalization and not the generalization itself i.e not System.Image. That way you have access to the attributes defined in your own entity.
Then in your Published REST Service you can just have an export mapping for that attribute.