Using pulldata() on Arcgis Online hosted Feature Service layer

586
1
Jump to solution
04-06-2022 09:43 AM
TKnutson
New Contributor II

I am trying to populate fields with attributes from a feature layer service hosted on ArcGIS Online. I am using the JavaScript sample template available on Survey123 Connect and following along with the Working with web services section of this blog post about the pulldata() function.

When I use the web service url provided in the template my survey works as expected (populates fields with attributes of the feature that intersects the geopoint). When I try with my own url from ArcGIS Online nothing happens. Am I missing something when publishing my layer as a feature service? It is shared with my organization and I am signed-in to Survey123. My url looks like this: https://services6.arcgis.com/1QLe7xIMQ0LfJiB1/arcgis/rest/services/XXXXXXXXXX/FeatureService/0 

0 Kudos
1 Solution

Accepted Solutions
magisian
Regular Contributor

I am assuming your service URL is not shared publicly, and that your user account signed into Survey123 will have access.

For services that are not public, you will need to add a hidden question to pull a token from the Survey123 app, and then reference that hidden question to pass the token as a parameter as part of the javascript pulldata.

A sample of this is in the blog you have referenced CTRL + F 'mytoken' to see the notes and sample. 

 

View solution in original post

1 Reply
magisian
Regular Contributor

I am assuming your service URL is not shared publicly, and that your user account signed into Survey123 will have access.

For services that are not public, you will need to add a hidden question to pull a token from the Survey123 app, and then reference that hidden question to pass the token as a parameter as part of the javascript pulldata.

A sample of this is in the blog you have referenced CTRL + F 'mytoken' to see the notes and sample.