cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Alan_Sanchez
Level: Powered On

Saved PDF is corrupted when saved to SharePoint or Emailed

Issue: Signed AdobeSign PDF saved to SharePoint and/or emailed as attachment is corrupt and cannot be viewed.

 

Scenario: A flow watches for a completed Adobe Sign agreement workflow, gathers field values and outputs the values to JSON. Values are used to save the PDF with a unique filename using one of the form field values. Signed PDF is also emailed to another department referencing the field value pulled from the JSON array.

 

Result:  The file is created in SharePoint with the correct name in the correct location, however upon attempting to view the PDF it is found to be corrupted. The email attachment is also corrupt despite being created in a separate step.

 

Troubleshooting: I figured this must be something in my flow, so I created a separate flow using the public "Save an Adobe Sign completed agreement to SharePoint Library" template and ran a test. The saved PDF was not corrupted and could be viewed.

 

My next step was to recreate the public template manually in a new flow. I mirrored the parameters exactly (with the exception of names to differentiate), and ran another test. The output PDF is corrupt.

 

Below are screenshots of the public template that works and the flow I made using the same parameters as the template. Why does this work in the template but not when creating a flow exactly the same from scratch?

 

Thank you in advance for your help.

 

Works.pngDoesnt work.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Saved PDF is corrupted when saved to SharePoint or Emailed

 

Hi @Alan_Sanchez ,

 

Please click the peek code to see if there is any difference between the expression actually configured in File content in these two actions.

197.PNG

Then you can use the following expressions to configure the File content field to see if it can solve your problem.

198.PNG

base64ToBinary(triggerBody()?['agreement']?['signedDocumentInfo']?['document'])
triggerBody()?['agreement']?['signedDocumentInfo']?['document'].$content

 

Best Regards,

Community Support Team _ Barry
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

3 REPLIES 3
Community Support Team
Community Support Team

Re: Saved PDF is corrupted when saved to SharePoint or Emailed

 

Hi @Alan_Sanchez ,

 

Please click the peek code to see if there is any difference between the expression actually configured in File content in these two actions.

197.PNG

Then you can use the following expressions to configure the File content field to see if it can solve your problem.

198.PNG

base64ToBinary(triggerBody()?['agreement']?['signedDocumentInfo']?['document'])
triggerBody()?['agreement']?['signedDocumentInfo']?['document'].$content

 

Best Regards,

Community Support Team _ Barry
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

Alan_Sanchez
Level: Powered On

Re: Saved PDF is corrupted when saved to SharePoint or Emailed

Hello @v-bacao-msft ,

 

I compared the code for each and they were identical. I tried your recommendation to use the expressions in place of the Adobe Sign trigger (I may be butchering that, I'm new to P/A) and that did the trick.

 

Here is a screenshot of what I did to apply the fix so others can see what worked for me.

Using expression:

base64ToBinary(triggerBody()?['agreement']?['signedDocumentInfo']?['document'])

fixed.png

 

Question: what is the difference between the two expressions provided? Are they just two ways of accomplishing the same result?

Community Support Team
Community Support Team

Re: Saved PDF is corrupted when saved to SharePoint or Emailed

 

Hi @Alan_Sanchez ,

 

I have summarized the solutions based on some previous problems.

 

First, I assume that the format of the document is not binary, so I converted it using the baseToBinary () function.

 

Secondly, I infer that we need to get the content of the document, because I speculate that it is already a binary file, but the file content needs the content property, so the content of the file is obtained based on the property name.

 

Based on the above speculation, I recommend the above expression, because I have no way to do the test, so I made some assumptions, but this turned out to be useful, really lucky.😁

 

Best Regards,

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

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Users online (6,246)