MS Flow to grab photos in Survey123 and add them to a sql report

2112
17
04-24-2019 08:02 AM
JevitaWebster
New Contributor III

i'm using MS Flow to grab data from a Survey in Survey123, but the survey has photos. Can i use MS Flow to grab these photos and add them to the SQL report?

Tags (1)
0 Kudos
17 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Jevita,

Currently, downloading an attachment in Flow is somewhat difficult.  Here is an example workflow:

The steps are:

  1. Send a request to the QueryAttachments Resource
  2. Parse the results of the request as JSON
  3. Extract the attachment id from the result (the ‘Compose’ step)
  4. (optional) Extract the attachment’s file name (the ‘Compose 2’ step)
  5. Request the attachment, using both the objectid of the feature and the id of the attachment

For steps 1 & 5, you will also need to provide a token of a user with the ability to query the feature service – Flow currently cannot access the token of the submitting user.

We are working to make this less cumbersome in the future.

0 Kudos
JevitaWebster
New Contributor III

does this work if the images question is in a repeater?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Jevita,

This basic technique would work for images in related records - the main difference is the URLs used in steps 1 & 5 should refer to the layer number of the repeat table in the service.

0 Kudos
JevitaWebster
New Contributor III

James, Can you export the flow? 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Jevita,

Here's the JSON export of the flow.

0 Kudos
NatalieAyala
New Contributor II

Are there any updates to this? Or possibly a new version of this JSON export? I've tried uploading this into Flow but get an error message. I've also tried recreated the flow as described but am having trouble finding the connectors from your screenshot above. 

I've got a Flow set up to generate a word document based on Survey123 data but need to include photos into the document as well. 

0 Kudos
NicholasConnolly
New Contributor II

Hi James,

Flow doesn't seem to be exposing the "attachmentInfos" "id" field. How do I get to the attachment id?

Thanks

Nicholas

MS Flow Attachment "id"

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Nicholas,

It looks like you may have supplied the wrong payload to the queryAttachments step.

0 Kudos
RichardHughes2
Occasional Contributor III

Hi James,

Today I am going to try a recreate your Flow to use attachments from a Survey.  We had issues with the Survey 123 Connector but we want to use Flow for handling event escalation and email notification from filtered surveys.  Do you know if there has been any progress on the MS Flow and Survey 123 issues in the past few months?  

0 Kudos