Survey123 photos and Power Automate

816
1
10-22-2021 10:10 AM
JennaOlson
New Contributor

I’m working on 2 issues.  Both dealing with Survey123 collected photos and Power Automate.  First, I am using the operation Excel Online and action “Add a row into a table”.  For the photo field I chose the Dynamic content of “feature attachments photos URL”.  A row is added to the Excel spreadsheet if a photo was submitted, but it won’t if there is no photo submitted.  I can’t figure out how to get it to work.  I suspect it has something to do with arrays and the “Apply to each”.  I’m sure I’m missing something simple, but not sure what. 

The second issue is the OneDrive for Business connector and Upload file from URL action.  When the photo is uploaded to OneDrive, it is there, but saved as type “file” instead of a .jpg.  Again, I’m sure there is something simple I’m missing, but I’m stumped.  Also my ArcGIS access is Government, so we do not have access to the HTTP connector which is a premium service.  Thanks for your help!

0 Kudos
1 Reply
abureaux
MVP Regular Contributor

I haven't tried pulling photos in a production survey yet, but I have pulled file attachments to attach in an email. (I have played around with photos though, so I am familiar with your second issue).

I use an Apply to each to loop over the array and subsequently append each item to an array.

abureaux_0-1637351027832.png

I do this first step in one Flow, and then I store the results of that array in an SP list, then this next step is in another Flow. Pretty sure the Compose isn't necessary if everything is in a single Flow, but I'll include it anyway for posterity. EDIT: For those reading that want to end up with an HTML Table as I have in my last step, and you are doing this all in one Flow: Just skip this middle step...

Then I Compose the array (remember when I said I am pulling my array from an SP list? You need to put your source inside json() or else you get an error) and set a Variable with that output:

abureaux_1-1637351449885.png

Then finally I add that variable I just set (obviously an array) to Create  HTML Table:

abureaux_2-1637351548764.png

This is what I put into my emails*.

*I settled on the HTML table method due to a bug/limitation in either S123 or Power Automate. Dont remember the exact issue off-hand, but I am working with support on it now.

 

As for the photos being saved without their file extension, that is because you need to pull the file extension from the array S123 gives you. That array contained the file name (name), extension (contentType), and path (URL). You need to pull them individually.

 

EDIT #2: How about I actually try answering your question this time...

So this is Esri's official blog post on pulling attachments: https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-working-with/ba-p/.... It uses the HTML connection which you specifically said you cannot use because you are in government. That means that you need a different solution. I tried Esri's solution and got errors no matter what I did. As mentioned above, something doesn't appear to be working correctly at this time, so you may not be missing out on much.

Let's jump back to my very first step for a second and zoom out a little:

abureaux_3-1637352077911.png

I use the Condition to test to see if the array is empty. Empty = no attachments (or photos, in your case). Not empty = at least one attachment. Assuming that S123's array isn't NULL, I use my Apply to Each to loop over it and create my own array (easier to work with I find). In your case, you could use the Apply to Each to add a row to your excel table with the URL to the photo.

 

0 Kudos