Passing feature attribute Code value instead of Label value

426
3
Jump to solution
02-01-2023 03:40 PM
mingster
New Contributor III

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.

 

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS
mingster
New Contributor III

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!

 

 

 

0 Kudos
jcarlson
MVP Esteemed Contributor

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}`

 

- Josh Carlson
Kendall County GIS