cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alan_Sanchez
Frequent Visitor

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
Community Support

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

4 REPLIES 4
Community Support
Community Support

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
Frequent Visitor

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
Community Support

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.
Alan_Sanchez
Frequent Visitor

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

This issue seems to have resurfaced and using the expressions provided aren't doing the trick.

 

I am not seeing the following error:

 

One or more fields provided is of type 'Null', a different type is expected.

 

2020-05-19 02_36_08-Run History _ Power Automate.png

 

I've tried moving this step to the very beginning of the flow and it still occurs whether attempting to attach the Adobe Sign PDF to an email or save to SharePoint. Any suggestions?

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: 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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (5,437)