Select to view content in your preferred language

Autofill field from layer in AGOL, in second group in survey123

126
2
Jump to solution
08-07-2024 04:18 AM
RileyScanlan
Emerging Contributor

Hi there,

I am trying to autofill an answer to a question in the second group in my survey123, pulling information from a layer in a field map. The user clicks the following URL in a hosted feature layer feature: 

 

arcgis-survey123://?itemID=xyzxyzxyzxyz&action=collect&field:GRID_ID={GRID_ID}&field:GRID_HA={GRID_HA}&field:

 

And the survey should fill out the GRID_ID and GRID_HA fields using the values in the original hosted layer's fields with the same names. I have this working in another survey where those questions are in the first 'group' of questions in a survey. Now I have another survey where the GRID_ID and GRID_HA questions are in a second group, and the autofill is no longer working. I should note the user must select 'yes' to a question in the first group in order for the second group to appear. Has anyone come across this? 


Thank you! 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

If you are using relevant to hide the fields then they have a value of "".  Passing in the values will not work since the field is not relevant at the time you are passing in.

You could try using hidden type instead but note this means even if they do not select yes the value will be there.

One way to pull this off is have two temp hidden fields that take in the values from the URL.  Then in your relevant questions later have a calc that pulls from the temp fields.  This way the fields will be "" if the user never selects yes and will get the passed in values if they do pick yes.

Hope that makes sense.

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

If you are using relevant to hide the fields then they have a value of "".  Passing in the values will not work since the field is not relevant at the time you are passing in.

You could try using hidden type instead but note this means even if they do not select yes the value will be there.

One way to pull this off is have two temp hidden fields that take in the values from the URL.  Then in your relevant questions later have a calc that pulls from the temp fields.  This way the fields will be "" if the user never selects yes and will get the passed in values if they do pick yes.

Hope that makes sense.

0 Kudos
RileyScanlan
Emerging Contributor

Oh thank you!! Great idea to use the hidden temp fields and pull from there. Seems to work really well.