Select to view content in your preferred language

Survey 123 Attachments corrupted when emailed using Power Automate

665
11
Jump to solution
4 weeks ago
MichaelTorbett
Frequent Contributor

I have a power automate flow that has worked fine up until a few weeks ago. It takes information from a survey 123 form and sends an email with an attachment. The flow executes successfully, but now, the pictures will not open from a email.  The workflow I use for attachments is here

Has anyone else recently had an issue with their attachment coming in corrupted? I'm wondering if this is from a recent update since my flow has not changed.

I've attached a screenshot of the flow I use. I have a case with ESRI Tech Support open as we speak.

Thanks,

Michael

0 Kudos
1 Solution

Accepted Solutions
MichaelTorbett
Frequent Contributor

@abureaux we were able to figure out the issue (sort of). The "Update File" and "Convert Word Document to PDF" actions were causing the attachment issues. Removing both of those actions and then readding them fixed the problem. However, what doesn't make sense is that I had already tried rebuilding the entire flow from scratch and it still produced the same problem. 

Therefore, we're not exactly sure what caused the problem, but deleting and readding the Update File" and "Convert Word Document to PDF" actions was the fix. 

View solution in original post

0 Kudos
11 Replies
abureaux
MVP Frequent Contributor

Curious why you are using "Populate a word document" and not the built in "Create report" step that Esri included? That would replace your first 3 steps all in one. 

Assuming you want to stick with this workflow setup, can you download the images as a standalone file? If so, that would be best. Just change the file extension to .txt and open one. Depending on the issue, your pictures may actually be text-based files that describe the error. If so, this should be easy to resolve. 

MichaelTorbett
Frequent Contributor

@abureaux the reason I use this workflow instead of the "Create report" action is because of credits. This flow triggers a lot and they add up over time. 

Thank you for the suggestion about changing the file extension to .txt . I see an "Invalid Token" message in the html. Now I just need to figure out why that is happening.

0 Kudos
abureaux
MVP Frequent Contributor

Makes sense! I honestly forget credits are a thing sometimes (I use Enterprise).

As for the message, have you tried refreshing your Esri connection yet? 

0 Kudos
MichaelTorbett
Frequent Contributor

Yes, I've tried refreshing the ESRI connection. but unfortunately that doesn't work. 

0 Kudos
abureaux
MVP Frequent Contributor

As you already have an open case, I suspect they will be able to troubleshoot pretty quick on a call.

But to keep poking at the low handing fruit, have you tried manually pasting the URL provided by S123 into your browser? If things are working properly, you should be taken to the image within your browser. If not, there is likely something wrong with your S123 Connection. 

0 Kudos
MichaelTorbett
Frequent Contributor

Yes, I am able to access the attachments from the url provided by Survey 123 as long as I provide a token at the end of the url. My support analyst and I are still troubleshooting. What we've discovered is that the attachments come through fine if I remove the word to pdf steps (leaving just the "HTTP"  and "send an email" actions). For some reason, when the "word /pdf" steps are added, the attachments fail. That's when I get the "token required" message at the HTTP action after a run. 

0 Kudos
abureaux
MVP Frequent Contributor

That's honestly an interesting issue. I assume both components work independently, so they should also work in tandem. 

The only thing that comes to mind to try would be moving the For Each loop to before the word, saving the images into db of some sort (SharePoint, OneDrive, etc.), building an array of photos, then run the conversion steps. 

Please do report back with the solution. 

0 Kudos
MichaelTorbett
Frequent Contributor

@abureaux we were able to figure out the issue (sort of). The "Update File" and "Convert Word Document to PDF" actions were causing the attachment issues. Removing both of those actions and then readding them fixed the problem. However, what doesn't make sense is that I had already tried rebuilding the entire flow from scratch and it still produced the same problem. 

Therefore, we're not exactly sure what caused the problem, but deleting and readding the Update File" and "Convert Word Document to PDF" actions was the fix. 

0 Kudos
abureaux
MVP Frequent Contributor

Hmm. You are correct. That technically makes zero sense. Also, be sure to mark your post as the solution as it may help others.

I will add something anecdotal as it may be related... I noticed in your initial screen capture that you are using the "modern" designer. I always avoid it. Reason being that I have found in the past that it silently broke components of my flow. It may be related to that.

0 Kudos