Bulk Patch Image Column In Dataverse From Canvas App


We have to upload images from Powerapps Canvas App in Bulk and need to store those images in Dataverse. It could be used by Field Technician to capture the device images or HR to capture Employees academic files.


I have created a new Image Column in Dataverse and one Text field to store the ID (ID is optional). I have created a new screen in Powerapps where I added Picture control, Label, Text Input, Two buttons as shown below.

Bulk Patch Image column in Dataverse from Canvas App

User will upload image and they will click on Add To Collection. Once all images are uploaded they will finally click on Patch To Dataverse to store those images in Dataverse.

I have written below code on Select of 'Add To Collection' button,

Collect(MyPhotos,{RecordId:TextInput1.Text, Image:UploadedImage1.Image});

First I am collecting image and Record Id in a collection, then I am resetting both the control.

Then I have written below code on Select of 'Patch To Dataverse' button,

ForAll(MyPhotos,Patch(Employees,Defaults(Employees),{'Record ID':Value(ThisRecord.RecordId), Image:ThisRecord.Image, 'Employee Number':ThisRecord.RecordId}));

In this code, I am looping through each row in the collection and patching it to dataverse. Then I am removing records from the collection and refreshing the Datasource to show the latest data in Gallery.

Hope this helps!