web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : NYHMamG6V4dUbwO5UTyofP
Power Automate - Building Flows
Answered

Upload file attachments to Dynamics 365 Finance

Like (0) ShareShare
ReportReport
Posted on 6 Jun 2021 17:31:55 by 945

Hi,

 

I'm creating PowerApps which utilize the attachments control, which going to be uploaded to my Dynamics 365 Finance, with help of Flow, by using D365 Finance data connector - Create records.

 

This guy:

Axal_0-1622999872186.png

Following some tutorial, in PowerApps, when I have the attachment control, then I should do these steps:

1. Add Image control (for my temporary holder)

2. Add this code for the image property :

 

Last(AttachmentsCtrl.Attachments).Value

 

3. Add button to convert the image to binary, using this code:

 

Set(tempFile, JSON(ImageTemp.Image, JSONFormat.IncludeBinaryData));
Set(FileUpload, 
 Mid(tempFile,Find(",",tempFile)+1,Len(tempFile)-Find(",",tempFile)+1)
);

 

 

When I'm using it to upload a small txt file, contain only 1 word, the result of those 2 variables looks fine with me :

tempFile -> data:text/plain:base64,VGVzdGluZw=="

FileUpload -> VGVzdGluZw=="

 

Then I will just need to create Flow to pass this FileUpload, along with my key fields (I specified all the keys correctly when I checked from the Flow)

 

However my Flow failed, with error -> An error has occurred. Exception has been thrown by the target of an invocation. Cannot convert the literal 'VGVzdGluZw=="' to the expected type 'Edm.Binary'.

 

The Output error is like this :

{
  "status"400,
  "message""An error has occurred.  Exception has been thrown by the target of an invocation.  Cannot convert the literal 'VGVzdGluZw==\"' to the expected type 'Edm.Binary'.\r\nclientRequestId: xxxx-xxxx-xxxx-xxxx--xxxxx",
  "error": {
    "message""An error has occurred.  Exception has been thrown by the target of an invocation.  Cannot convert the literal 'VGVzdGluZw==\"' to the expected type 'Edm.Binary'."
  },
  "source""xxxxxxxaos.cloudax.dynamics.com",
  "errors": []
}

 

May I know what's wrong with this ? 

 

Thanks.

 

 

 

 

 

I have the same question (0)
  • v-LilyW-msft Profile Picture
    on 07 Jun 2021 at 06:27:31
    Upload file attachments to Dynamics 365 Finance

    Hi @Axal 

    Glad to see your problem solved, thank you for sharing the solution.

    Best Regards

  • Verified answer
    Axal Profile Picture
    945 on 07 Jun 2021 at 04:39:15
    Re: Upload file attachments to Dynamics 365 Finance

    Sorry, it was the formula error ->

    Set(FileUpload, 
     Mid(tempFile,Find(",",tempFile)+1,Len(tempFile)-Find(",",tempFile)+1)

    should be "-1" in the end 

     

    Solved.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 954 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 650 Moderator

#3
trice602 Profile Picture

trice602 327 Super User 2025 Season 2

Last 30 days Overall leaderboard