Select to view content in your preferred language

how to prepopulate a question from a layer by clicking on the map

192
12
Wednesday
FSD_Main
Occasional Contributor

Hi-

I'm wondering if it's possible to click on a map either from Field Maps or a map in Survey123 that would then prepopulate certain questions? I have done some research and tried this: pulldata("@layer", "getValueAt", "attributes.NEW_MH_ID", "https://services7.arcgis.com/nZUcF2JydS8L5n3y/arcgis/rest/services/FSDMH/FeatureServer/2",${location}) but it's not functioning for me the way I would like. And not sure if this can only be used for polygon layers as the layer I'm wanting is a point layer. I had also tried creating a url that goes into the pop-up so when they click on the manhole it then should take them to survey123, but when I test it out it doesn't open the survey. If someone could tell me what i might be doing wrong that would be great!

Here is the code for the popup url which was generated through GitHub:  <a href="arcgis-survey123://?itemID=0f782ed1a0de433b97092951c1038447&amp;field:manhole_id={NEW_MH_ID}&amp;field:manhole_depth={Z}"><img src="https://dabuttonfactory.com/button.png?t=MH+Survey&amp;f=Roboto-Bold&amp;ts=24&amp;tc=fff&amp;tshs=1..." alt="MH Survey"></a>

12 Replies
DougBrowning
MVP Esteemed Contributor
0 Kudos
FSD_Main
Occasional Contributor

 This was the document I had originally referred to:

https://community.esri.com/t5/arcgis-survey123-blog/understanding-survey123-s-custom-url-scheme/ba-p...

But when I followed these steps and click the link in the pop up I get an untitled/about blank web page. Nothing opens up. This was the original URL: 

"arcgis-survey123://?itemID=0f782ed1a0de433b97092951c1038447&amp;field:manhole_id={NEW_MH_ID}&amp;field:manhole_depth={Z}" before I found this blog: 

https://community.esri.com/t5/arcgis-survey123-questions/announcing-a-handy-tool-to-generate-survey1... 

The documents you sent me pretty much state similar things and this where I'm struggling getting it to actually function as these documents state. 

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Are you wanting a web browser or app to open?  Is this on a tablet or windows?  Opening the windows app does not usually work but someone posted it recently they got it to go.

FSD_Main
Occasional Contributor

Well I'm building this out on a web browser but in the end it will be used on an ipad. 

0 Kudos
FSD_Main
Occasional Contributor

So it did work on the ipad except the questions that i wanted pre populated didn't fill in.... i'll keep playing with this i guess. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

I can't tell if you text is being changed in the window here adding the amp; stuff but you may be missing the :

Should look like arcgis-survey123://?itemID=b02fc3613d344ee1&field:PointID={PointID}

DougBrowning
MVP Esteemed Contributor

Ok the arcgis-survey123://? part says launch an app so its not going to work in Windows.  To open web browser it has to start with the http way (https://survey123.arcgis.app).   Best thing is to test on a tablet really.  Otherwise change to the http to test but it does not tell you as much.  Basically you are telling windows to launch an app you don't have.  I know the directions sound like it may work but it does not.  You can try getting the windows app but I have had no luck with that.  (note NOT connect but just the 123 app for windows).

Hope that makes sense

FSD_Main
Occasional Contributor

it did have those "amp;" in them. I did remove them but still not prepopulating those questions in survey123. I am using survey123 connect to make any edits to the survery. Yeah i did see that it said for app, so i am now testing it through the ipad. 

This is what it calls out in the pop up: arcgis-survey123://?itemID=0f782ed1a0de433b97092951c1038447&field:manhole_id={NEW_MH_ID}&field:manhole_depth={Z} 

When i select a MH in field maps this url does replace the {PointID}s with the associated attributes, but when i click it and it takes me to the survey it does not show them in questions i called out. Maybe I have the type or something set incorrectly in the form that's preventing this?  (I'm still pretty green to building surveys)

typenamelabelhintguidance_hintappearancerequiredrequired_messagereadonlydefaultcalculationconstraintconstraint_messagerelevantchoice_filterrepeat_countmedia::audiomedia::imagebind::typebind::esri:fieldTypebind::esri:fieldLengthbind::esri:fieldAliasbody::esri:stylebind::esri:parametersparametersbody::acceptbody::esri:visiblebody::esri:inputMasklabel::language (xy)hint::language (xy)guidance_hint::language (xy)required_message::language (xy)constraint_message::language (xy)media::audio::language (xy)media::image::language (xy)body::accuracyThresholdbind::esri:warningbind::esri:warning_messagebind::saveIncompletebind::esri:workflow
textmanhole_idManhole ID  autocompleteyes                                 
integermanhole_depthManhole Depthin feet                                    
0 Kudos
DougBrowning
MVP Esteemed Contributor

Not sure what this means?  in field maps this url does replace the {PointID}s with the associated attributes,

are any of the fields arcade expressions or anything like that?  I have not tried to access a Z value before is that a real field that has values?

This looks correct to me on the formatting.  When it fails it tends to be the wrong type, or too long for the field, or trying to pass into a repeat which you cannot do.