cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Hi all,

I've been trying to upload an image to CRM through Microsoft Flow.

I basically have an app that uses Camera component to take a picture, after the picture is taken, I want to create a record in Dynamics 365. I have a custom entity set up where its entityimage field is enabled. 

 

I am facing a bad request where the return message error is "Invalid Argument". Below you can see my request.

 

{
"cds_amount": 1,
"cds_customerlocation": "1",
"entityimage": "aVZCT1J3MEtHZ29BQUFBTlNVaEVVZ0FBQUFVQUFBQUZDQVlBQUFDTmJ5YmxBQUFBSEVsRVFWUUkxMlA0Ly84L3czOEdJQVhESUJLRTBESHhnbGpOQkFBTzlUWEwwWTRPSHdBQUFBQkpSVTVFcmtKZ2dnPT0="
}
 
And this is the response.
 
{
"status": 400,
"message": "Invalid argument.",
"source": "powerappsdemo2018.crm.dynamics.com",
"errors": [],
"debugInfo": "clientRequestId: 0f76d94e-ea8b-48f4-b462-a4b94206328c"
}
 
By the way, the base64 I'm showing is just an example, the base64 I take from the app is much bigger. All the base64 I've tested so far give me the same error and I have also checked multiple times if the base64 is valid.
 
I would appreciate any help.
 
Thank you
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Hey, just had to come back to it after months and just realised how to do it.

 

The flow is really simple.

  1. I have a parameter called base64txt which will be supplied in my App.
  2. I then convert the base64txt to binary using the function base64ToBianry.
  3. Create desired record passing the output to Entity Image field.

 Untitled.png

 

Important noticing that to capture the image use the property .Photo of the camera, so if your camera component is called camera1 it would be camera1.Photo and the base64 returned starts with "data:image/png,base64,iVHDUAW...".

 

We need to remove this data:image/png,base64, piece so it would be only "iVHDUAW..." in my case. 

 

I chose to handle that on my App side but you can do whichever side you want.


Hope it helps

View solution in original post

4 REPLIES 4
Highlighted
Frequent Visitor

Re: Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Hi! @BrunoTww Did you ever figure this out? I'm looking to do the same thing and encountering the same error. 

Highlighted
Anonymous
Not applicable

Re: Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Bumping for visibility 

 

@Anonymous 

Highlighted
Frequent Visitor

Re: Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Hey, just had to come back to it after months and just realised how to do it.

 

The flow is really simple.

  1. I have a parameter called base64txt which will be supplied in my App.
  2. I then convert the base64txt to binary using the function base64ToBianry.
  3. Create desired record passing the output to Entity Image field.

 Untitled.png

 

Important noticing that to capture the image use the property .Photo of the camera, so if your camera component is called camera1 it would be camera1.Photo and the base64 returned starts with "data:image/png,base64,iVHDUAW...".

 

We need to remove this data:image/png,base64, piece so it would be only "iVHDUAW..." in my case. 

 

I chose to handle that on my App side but you can do whichever side you want.


Hope it helps

View solution in original post

Highlighted
Frequent Visitor

Re: Uploading Image to Dynamics 365 through PowerApps/Microsoft Flow

Just realized that you can use the function dataUriToBinary so you can just pass camera1.Photo value not having to replace anything. Much more clean way to do it.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,814)