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

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
v-bacao-msft
Community Support
Community Support

 

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
v-bacao-msft
Community Support
Community Support

 

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

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?

 

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.

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,480)