cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
barlowse
Advocate IV
Advocate IV

Image Field on Dataverse

How do I patch a record in a Dataverse table's image column? I can do this in Sharepoint but not sure how to do this with Dataverse. 
I don't want to use Power Automate, it has to be with a patch formula. 
This is what I have but get an error that says the datasource is invalid...

The image is in an Image control called HiddenImageControl1.

upload file to companies.JPG

Formula on my Upload button.
Set(_addfile,JSON(HiddenImageControl_1.Image,JSONFormat.IncludeBinaryData));
Set(_base64File,Mid(_addfile,Find(",",_addfile)+1,Len(_addfile) - Find(",",_addfile) -1));
Set(_upload, false);
Patch(Filter(Companies, 'Company Name' = CompanyName.Text),
{'Company Logo':HiddenImageControl_1.Image});
 
Below is the error from Monitor when I click the button.
 
error loading file.JPG
Anyone tried to do this?
2 ACCEPTED SOLUTIONS

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @barlowse ,

 

Firstly, please make sure the picture is in base64 format.

Secondly, Image column expects a record . Its format is {Image:{Value:"***",Full:"***"}}

 

I've made a test for your reference:

1\ This is my image control 'Image1'.

v-xiaochen-msft_0-1612414475398.png

 

 

2\ Add a button control and set its onselect property to:

Patch(Students,First(Students),{Image:{Full:Image1.Image,Value:Image1.Image}})

 

3\ Add another image control 'Image2' to show the Image value in my first record.

Set the image property of 'Image2' to:

First(Students).Image.Full

 

4\ The result is as follows:

v-xiaochen-msft_1-1612416169138.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

Thanks for the help! I figured out that my issue was having a filter in my Patch statement. Once I removed that - all worked beautifully.

View solution in original post

2 REPLIES 2
v-xiaochen-msft
Community Support
Community Support

Hi @barlowse ,

 

Firstly, please make sure the picture is in base64 format.

Secondly, Image column expects a record . Its format is {Image:{Value:"***",Full:"***"}}

 

I've made a test for your reference:

1\ This is my image control 'Image1'.

v-xiaochen-msft_0-1612414475398.png

 

 

2\ Add a button control and set its onselect property to:

Patch(Students,First(Students),{Image:{Full:Image1.Image,Value:Image1.Image}})

 

3\ Add another image control 'Image2' to show the Image value in my first record.

Set the image property of 'Image2' to:

First(Students).Image.Full

 

4\ The result is as follows:

v-xiaochen-msft_1-1612416169138.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

View solution in original post

Thanks for the help! I figured out that my issue was having a filter in my Patch statement. Once I removed that - all worked beautifully.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,755)