cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Powerapp to import an image into Fin & Ops

Hi,

 

I created an app to take a picture and import it on product in Fin&Ops.

I followed this example: https://cleverax.wordpress.com/2020/04/05/msdyn365fo-powerapp-to-upload-a-photo-as-a-document-attach...

 

But I have an error when I want to create the product document attachment as an image. (If I create a note with text, it works).

Here is my error message: "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: 46ff7aab-6467-4c7e-8d70-5d530ac74d25"

 

Here is the last step of the power automate:

271.png

 

Image from the Canvas app:

272.png

 

The Input used for the 'Create a record' step seems ok:

{"host":{"apiId":"subscriptions/b745f25e-91b5-4140-9d73-93b10b1dfb1d/providers/Microsoft.Web/locations/westeurope/runtimes/europe-002/apis/dynamicsax","connectionReferenceName":"shared_dynamicsax","operationId":"PostItem"},"parameters":{"dataset":"xxxxxxx.cloudax.dynamics.com","table":"ProductDocumentAttachments","item/ProductNumber":"00000011","item/DocumentAttachmentTypeCode":"Image","item/AttachmentDescription":"Text input","item/DocumentAttachmentTypeLegalEntityId":"USMF","item/ProductImageUsage":"Internal","item/Attachment":"iVBORw0KGgoAAAANSxxxxxx".....

So, the item/attachment seems right...

 

Do you have ideas?

If anyone can help?

 

5 REPLIES 5
Helper I
Helper I

I make a Parse, then I initialize a variable and the value of variable is:

{"variables":[{"name":"ImageURI","type":"String","value":"data:image/png;base64,iVBORw0KGgoAAAANSUxxxxxxx"}]}

I have to make a convertion ton only keep the iVBORw0KGgoAAAANSUxxxxxxx but I don't find the good function to do this.

If anyone can help?

@Frog64

 

1) When you try with a few test images like 3 to 5 of them, and you get the base64, which exactly would be the parts of the base64 you want to keep?


2) Also is it with this phrase below as well included in the beginning of the string to extract, or is it without it and starting directly with the iVBORw0KG...... part?

 


@Frog64 wrote:
data:image/png;base64,

 



Please check on the above and let us know your results, then we might attempt to advise you of a function or way to keep the base64 in that particular pattern or way.

@poweractivate 

I only take one picture with the app, with the camera of laptop or smartphone: so I never take several pics at the same time before using my power automate flow.

 

The only thing I need to put on the field 'Attachment' in the step 'Create a record', is the value of "iVBORw0KGgoAAAANSUxxxxxxx".

If I put this chain iVBORw0KGgoAAAANSUxxxxxxx manually, the picture is well uploaded in Fin&Ops, so I need to extract only this part. I hope I was clear 🙂

Super User II
Super User II

@Frog64 

 

You can use the split function then get index 1, like this:

 

split('data:image/png;base64,iVBORw0KGgoAAAANSUxxxxxxx','data:image/png;base64,')?[1]

 

Check out this example:

 

Exhibit 1: Definition of the Flow - example

 

5a.gif

 

 

Exhibit 2: Test running the Flow and inspecting the outputs:

 

5b.gif

 

 

 

 

 

Helper I
Helper I

Seeing my output of the last step, everything looks normal, and specially the attachment field...

but it doesn't work, there is something else that blocks the flow:

281.png

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (67,403)