Showing results for 
Search instead for 
Did you mean: 

Attaching Camera photos without either a Flow or JSON

There have been a methods posted regarding attaching camera photos using JSON. This one I think is simpler and involves a "re-purposed" attachment control.

In the below example, the “Photos” control is a normal (but re-purposed) Attachment Control on a form. The Attachment Control on the right is in another form displaying the same record to demonstrate that this works. The photo names are simply the time they are taken - you could use whatever you want here.


So what is happening?

Firstly, when the “Camera” icon is pressed, it does this OnSelect

UpdateContext({varPID: GUID()});
        Value: camAttach.Stream,
        DisplayName: Text(
        ) & ".jpg",
        Id: varPID,
        AbsoluteUri: ""

You also need to set your Camera StreamRate - 100 (one tenth of a second) seems to work well.
And then the “Save” icon OnSelect


You can probably delete the Refresh in most cases and would also clear the collection at Screen OnVisible.
The Update of the Data Card (generally standard for control I named acPhotos)


The Items of the Attachment Control on the left is (instead of Parent.Default)


The most important bit is the changes to the acPhotos Attachment control



You are displaying the collection in the control instead of the attachments and have structured its fields to mirror a normal attachment. When the form is submitted, the control attaches all the photos (and then the code clears the collection). It also gives the user the ability to see what is being attached and delete if not required.
You could also display the photos in a Gallery underneath with the Items



and the Image of


for a better review before attaching.
My thanks also goes to @PhilM and his colleague @rilind for the inspiration to this process.