Easiest Way to Upload Images to Dataverse From Power Apps

While working on a client project, I faced a common requirement. The client wanted users to upload images directly from a Power Apps form and store them securely in Dataverse. This was needed for scenarios like uploading ID proofs, profile photos, or supporting documents during form submission.

At first, it sounded simple, but when you actually start implementing it, you realize there are a few important things to understand, such as configuring the Dataverse image column, connecting it properly in Power Apps, and saving the image without errors.

In this tutorial, I will explain how to upload images to Dataverse from Power Apps with examples.

Dataverse Upload Images From Power Apps

Let’s follow the instructions below to upload Power Apps images to the Dataverse table.

  1. In the image below, you can see there is a Dataverse table called TSinfo Site Galleries. This table has an image column named SiteImage where all photos will be stored.
Dataverse Upload Images from Power Apps
  1. Now I would like to upload the Power Apps image to this Dataverse image column. To do so, we will create a Blank Canvas app in Power Apps.
  2. Once the app is ready to use, the next step is to create a Dataverse connection and connect to the specific Dataverse table (TSinfo Site Galleries) where we want to store the image.
    • Go to Data -> + Add data -> select the Dataverse table TSinfo Site Galleries under Tables. The table is now ready to use in Power Apps.
powerapps upload image to dataverse
  1. To upload an image, add an Add picture control from Insert -> Media -> Add picture, as shown below.
powerapps upload file to dataverse
  1. Add a Button control to upload the image to the Dataverse image column. Provide the button text as Upload Image.
upload powerapps image to dataverse

That’s it to do in Power Apps. Next, we will create a flow in the app.

  1. To create a new flow, on the Power Apps screen, go to the Action tab -> Click Power Automate -> Create new flow -> + Create from blank as below.
Upload image to Dataverse from Power Apps
  1. The Power Apps flow will appear as shown in the screenshot below. Click on + New step to add a new step below the PowerApps.
How to upload image to Dataverse from Power Apps
  1. Search Add a new row action under the Microsoft Dataverse section. The action will appear in the PREMIUM version. Click and add it over there.
Power Apps images to Dataverse
  1. Expand the Add a new row action and provide the Dataverse table name (TSinfo Site Galleries) where you want to upload the image.
Power Apps image to Dataverse
  1. Expand on Show advanced options and enter the following field values:
  • SiteName = Go to the Dynamic content of this field and click on Ask in PowerApps. Then the field value will be set to whatever you provide in Power Apps.
PowerApps image to Dataverse Table
  • SiteImage = Similarly, go to Dynamic content and click Ask in PowerApps. If you cannot see this option, tap the See More option to make it visible.
Upload PowerApps image to Dataverse Table
  1. Provide a name for the flow (Upload PA Image to DV) and save it.
Power Apps images to Dataverse Table
  1. Return to the Power Apps screen and apply the code below to the button’s (Upload Image) OnSelect property as:
OnSelect = UploadPAImagetoDV.Run("New Image",JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData))

Where,

  • UploadPAImagetoDV = Flow name that you have created recently
  • New Image” = Provide a name for the image that will be uploaded to the Dataverse table
  • UploadedImage1 = Image control name from the Power Apps Picture Control
Upload images to dataverse from Power Apps
  1. Once it’s done, save, publish, and preview the app. Tap the picture control to select an image from the system, then tap the Upload Image button.
How to upload image to dataverse from PowerApps
  1. Now, go to the flow and check the flow run history (My Flows –> Select Flow Name -> Tap on Show more option -> Run history). You will see that the flow run has failed. The right side of the page represents the error details that say: “InnerException : Microsoft.OData.ODataException: Cannot convert the literal ‘”data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHC….”
How to upload Power Apps image to dataverse

The above error message specifies “Cannot convert the literal data image“, which means the Dataverse image column is expecting only the binary types, not any other content types.

  1. To overcome this issue, edit the flow and add a Compose action below the PowerApps trigger action. Click on the + icon -> Add an action -> Search for “Compose” in the search bar -> Select “Compose” under the Data Operation section as shown below.
Power Apps image to dataverse

The compose action has only one field, i.e.,

Inputs = Go to the Expression tab and apply the code below,

Inputs = replace(split(triggerBody()['Addanewrow_SiteImage'],',')[1],'"','')

Where,

Addanewrow_SiteImage‘ = This is the Site image column name from the Add a new row action. (As before, you have selected the Ask in PowerApps option to add it)

Once you have applied the formula, click OK.

Power Apps image to dataverse table
  1. Next, expand the “Add a new row” action and remove the image name (Addanewrow_SiteImage) from the SiteImage field. Go to the Dynamic content tab and add the Outputs under the Compose section as like below.
Upload Power Apps image to dataverse table

That’s all there is to do in the flow. Now save the flow and go back to the Power Apps app.

power apps upload image to dataverse
  1. Then save, publish, and preview the app. Upload an image using the Upload Image button. You will notice that the flow status shows successful after you look at the flow run history.
store image in dataverse

Go to the Dataverse table (TSinfo Site Gallery) now to see the newly uploaded image in the table’s top row.

powerapps upload image file to dataverse

This way, we can upload images from Power Apps to a Dataverse table in steps.

Also, you may like some more Dataverse tutorials:

1 thought on “Easiest Way to Upload Images to Dataverse From Power Apps”

Leave a Comment

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App