I am using a custom URL scheme to prepopulate survey questions using the attributes from a selected feature in a web map. My question is, how should the Survey123 custom URL scheme be written so that it passes the Code value of a feature layer's attribute and not the Label value?
Thank you.
Solved! Go to Solution.
How are you generating the URL? If you use Arcade, you'll be able to pull in the actual value, but other popup elements are actually calling DomainName($feature, fieldname) in the background. An expression lets you explicitly ask for $feature['fieldname'] instead.
How are you generating the URL? If you use Arcade, you'll be able to pull in the actual value, but other popup elements are actually calling DomainName($feature, fieldname) in the background. An expression lets you explicitly ask for $feature['fieldname'] instead.
Hi Josh,
I used a basic URL scheme: arcgis-survey123://?itemID=227a34602bb44d309b24f5f06dfac989&field:location_type_ind_fs={sitetype}&field:wma_nm_ind={wma}. I need the Code values for sitetype and wma to prepopulate in Survey123.
I did not think about using Arcade! So I should create Arcade expressions to ask for $feature['fieldname'] for these fields and replace the values within the curly brackets with those expressions?
Thank you for your help!
Yes, you've about got it. You can do it a number of ways, but I like using template literals to build URLs, like this:
var field1 = $feature['some_field']
var field2 = $feature['another_field']
return `survey-url?itemid=someID&field:field1=${field1}&field:field2=${field2}`