Select to view content in your preferred language

Attachments in Survey123 Field App

2427
18
06-22-2022 10:53 AM
GIS_utahDEM
Occasional Contributor II

Is there a projected timeline when file attachments will be available in the inbox as well? I currently don't have the ability to change the field type, put it in a repeat or add an additional question (the inbox is one small portion of a large multi-user interactive process involving the web app, dashboards, view layers, submission urls, etc.), but I really need my inbox users to be able to see previously submitted attachments and add additional attachments to a multiline "file" question. As far as I understand there is no way to do this right now without changing the field type or adding an additional field? 

18 Replies
ZacharySutherby
Esri Regular Contributor

Hello @GIS_utahDEM

The ability to access file attachments in the Inbox is still in our backlog and we don't have a timeline at the moment. As a workaround to access existing file attachments a JavaScript function can be used to query the queryAttachments endpoint and return the URL for the file attachment. That URL can then be used as a hyperlink in a note question so the user can download the attachment on their device. Please see the sample below for reference (all that needs to be updated is the REST URL's in the JS file). 

Thank you,
Zach
GIS_utahDEM
Occasional Contributor II

@ZacharySutherby Thanks so much for your response! I am not very experienced with javascript so I'm unfortunately still having some issues:

I have copied the code and survey fields over, and I am able to publish -- but when I go into the field app and try to click "Access Attachment" it says I'll need a new app to open the qrc link. I'm guessing (I could be completely wrong) that it has something to do with the URL and the id field that I swapped to. I don't have inc_id so instead I used my case_number field which is a text field with no restrictions. I swapped inc_id in line 15 (let where = "where=inc_id="+"'"+incid+"'";) to case_number, and I swapped the layerURL for my feature layer. Another thing that may be weird is that my survey has a submission URL which is pointing at a view layer of another hosted feature layer (which was created by a survey) -- not sure if that would affect anything. 

Appreciate any insight you have!!

0 Kudos
ZacharySutherby
Esri Regular Contributor

Hello @GIS_utahDEM

When you modified the JS file did you update both the queryfl() function and the query_attach() function? If so if you make the question that runs the JS function a note question does it return a URL? Ex. 

ZacharySutherby_0-1656004809510.png

 

Thank you,
Zach
0 Kudos
GIS_utahDEM
Occasional Contributor II

@ZacharySutherby Yes, I was able to swap both URLs. 

I am including a screenshot of what I see when I click the "Access Attachment" link. I am unable to right click it or inspect in any other way as far as I can tell. 

I am also including a screenshot from my survey123 connect and the .js file that I'm referencing

GIS_utahDEM_0-1656006462751.png

GIS_utahDEM_1-1656006691154.png

 

 

0 Kudos
Czapiga_Jason
New Contributor II

Are there any updates on a timeline for this functionality?

 

EdKnowles
New Contributor III

G'day Zach!

How would this work for multiple file questions in the one survey?

If I click on attachments in the table view in AGOL, the popup shows all attachments.

Thanks heaps

0 Kudos
ToddW_stl
Esri Contributor

Have you seen my suggestion near the end of this thread?  If you have multiple file questions, I think my solution would work.  I'm not familiar with Zach's idea, so I can't be much help there.

0 Kudos
EdKnowles
New Contributor III

G'day Todd

I tried Zach's first, as it was, well, first 🙂

Looks like I will run with your approach due to the multiple file questions.

Though now my time questions validation fail.

Out of scope for here and I think known not supported in the browser 😢

PS Neat trick with the GlobalID

Thanks

ZacharySutherby
Esri Regular Contributor

Hello @GIS_utahDEM

If you switch the query_attach question from a calculate to a note or text question when you are in the Inbox does that display a URL?  

Thank you,
Zach
0 Kudos