cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Upload File attachment to Dynamics Product

Hello,

 

I'm unable to upload a File/Artwork/Image as an attachment to an existing product in Dynamics Finance and Operations. The base64 data in the request is 100% valid and I'm able to decode the image back into its original form.

 

The request looks like this:

 

 

{"method":"post","path":"/datasets/adlsanrp01new3538057bcf1407e7aos.cloudax.dynamics.com/tables/ProductDocumentAttachments/items","host":{"api":{"runtimeUrl":"https://europe-002.azure-apim.net/apim/dynamicsax"},"connection":{"name":"/providers/Microsoft.PowerApps/apis/shared_dynamicsax/connections/0f730d386213436498436ab06c753462"}},"authentication":{"value":"*sanitized*","type":"Raw"},"body":{"ProductNumber":"0003","DocumentAttachmentTypeCode":"Image","AttachmentDescription":"Sample description...","DocumentAttachmentTypeLegalEntityId":"USMF","AttachedDateTime":"2020-05-20T18:50:52.9076013Z","OriginalFileName":"pizza","FileType":"image/png","IsProductImage":"Yes","Attachment":{"$content-type":"image/png","$content":"iVBORw0KGgo...

 

 

 

This is my setup:

1.PNG

2.PNG

 

This is what I get as error:

 

 

An error has occurred.  Write failed for table row of type 'EcoResProductDocumentAttachmentEntity'. Infolog: Error: Error executing code: Binary (object), method constructFromContainer called with invalid parameters..
clientRequestId: e38af0cf-b157-45bd-82ed-1ac199c1f565

 

 

 

I'm using the following to construct the Attachment attribute:

 

 

dataUriToBinary(concat('data:image/png;base64,', triggerBody()['file']['contentBytes']))

 

 

 

Could this be a bug in F&O? Your help is appreciated! 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Upload File attachment to Dynamics Product

Hi @echammas,

 

Two methods you could have a try:

Use the File content directly, if create the file in the SharePoint, use the file content directly will be successful, but I don't if it would work in Dynamic, I couldn't test it cause account limitation:

Annotation 2020-05-21 140157.jpg

 

Or you could use the binary() function to convert the contents into a binary:

Annotation 2020-05-21 140233.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Upload File attachment to Dynamics Product

Hi @echammas,

 

Two methods you could have a try:

Use the File content directly, if create the file in the SharePoint, use the file content directly will be successful, but I don't if it would work in Dynamic, I couldn't test it cause account limitation:

Annotation 2020-05-21 140157.jpg

 

Or you could use the binary() function to convert the contents into a binary:

Annotation 2020-05-21 140233.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
New Member

Re: Upload File attachment to Dynamics Product

Hi @v-litu-msft, Thanks for your reply. I already tried these two approaches. They give the same error.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (11,236)