I'm creating an app that allows users to create various registrations. These registrations might include a photo they have to take on the spot with the device camera. What's the best way to achieve this? (Everything is purely based on CDS)
My first approach was to add an 'Image' field to my entity, and Patch the photo to that field. However, I found that this will simply create a super compressed 'entity image' that is useless in practice.
I'm now looking at enabling Notes for the registration entity, and add the photo as a notes attachment to the registration. However will it be possible this way? I was playing around a bit like this:
// test sending photo as notes attachment
Patch( Notes, Defaults(Notes), {
subject:"Photo test",
notetext:"Description text",
filename: "photo.jpg",
_objectid_value: First(Accounts),
documentbody: PhotoDialog_1.Foto, // note to reader: this is the output of an 'Add picture' control (AddMediaButton.Media)
isdocument:true
} );
However, this is simply giving me an OData exception when executed:
