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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / F&O Document Attachmen...
Power Automate
Answered

F&O Document Attachment Fails with email Trigger

(1) ShareShare
ReportReport
Posted on by 4

I am creating a flow in which it trigger when email arrives in specified mail which content pdf attachment. That pdf attachment need to be added to specified shipment in D365 F&O. Here is my flow screenshot

ManthanK_3-1668688896261.png

 

 

But it is getting failed in create record. Error is "

An error has occurred.  Write failed for table row of type 'ZPShipmentHeaderDocumentAttachmentEntity'. Infolog: Warning: 'FileContents' is required when attaching a file; Warning: validateWrite failed on data source 'DocuRefEntity (DocuRefEntity)'

". Even though I have specified file content. Also in compose it shows value.
The same failed flow works fine on resubmit. Please help me with this problem

Categories:
I have the same question (0)
  • v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @ManthanK ,

    Do you want attachment content?
    First you should set the option to include attachments to Yes

    thumbnail_image.png

    or
    You need to add a Get Attachment action to get the attachment content.

    thumbnail_image001.png

    Best Regards,

    Dezhi

  • ManthanK Profile Picture
    4 on at

    v-dezhili-msft, Thanks for the solutions you have provided but option of include attachments is already set to Yes and i had tried the Get attachment action but it is also failing.

  • Bharath_v Profile Picture
    36 on at

    Hi @ManthanK ,

    I am also trying the same but i need to attach the document with "VendorDocumentAttachmentEntity"  entity.  If you have any solutions please let me know as well.

  • James Lyn Profile Picture
    10 on at

    I managed to successfully import PDFs into D365 using the VendorInvoiceDocumentAttachments entity. For the Archive file field (File Content), normally the base64 of the File Content needs to be passed, however it was throwing the error that the OP mentioned. I wrapped the base64 expression with a trim expression and the PDF loaded fine. Example expression:

    trim(base64(outputs('Get_document')?['body']))

     

    In my example, the Get_document is pulling from a Dataverse connector, but I also managed to use the trim function to successfully load a PDF file from the SharePoint Get File Content connector. I suspect the connector may be trying to convert the base64 passed in some way causing D365 to error out and the trim may force it through as a string.

  • Bharath_v Profile Picture
    36 on at

    Thanks @jlyn ,

     

    We also able to import the attachment with above example. Thanks once again

  • krawad Profile Picture
    9 on at

    Thanks Jlyn for the solution, i tried the above function witht base64 and trim functions; the flow actually succeded but the file in F&O was unreadable.

    PS: i receive the file by email attachment, i tried to save it on onedrive then get its metadata but didnt work as well.

    Also the file saved in onedrive is readable.

     

    Thanks!

  • Verified answer
    Bharath_v Profile Picture
    36 on at

    Hi @krawad ,

     

    I am faced that issue. So, i tried this way and its worked. May be this will help you to solve the problem.

     

    Bharath_v_0-1679371387281.png

     

  • krawad Profile Picture
    9 on at

    thank you so much @Bharath_v it worked perfectly!

  • Shivani Thakur Profile Picture
    6 on at

    worked for me as well. Thanks

  • Shivani Thakur Profile Picture
    6 on at

    This worked for us as well. Thanks a lot

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 248 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 204

#3
Haque Profile Picture

Haque 179

Last 30 days Overall leaderboard