How to initiate feature collection for a layer in Collector from Survey123

685
5
01-04-2019 05:39 AM
DakotaHamilton
New Contributor

Currently I can launch a specific collector map from Survey123 using a url and itemID. What I would like to do is initiate a feature collection in a specific layer within that collector map and pass an attribute to the collected feature from Survey123. Thus far I have been using this: GitHub - Esri/collector-integration: Multi Language repository that contains documentation and sampl... and GitHub - Esri/collector-integration: Multi Language repository that contains documentation and sampl... but have been unsuccessful getting anything beyond linking to the Collector map to work. 

<a href="arcgis-collector://?itemID=0539f9d42f314b0587e5e5cd82587a5e">Launch Collector</a>

successfully launches the collector app but this:

<a href="arcgis-collector://?itemID=0539f9d42f314b0587e5e5cd82587a5e&featureSourceURL=https://services9.arcgis.com/oYDccLD4RNQkDAu8/arcgis/rest/services/BMP_Collection_WFL1/FeatureServer...">Launch Collector</a>

as well as including the token from the ArcGIS REST services directory fails to initiate a feature collection.

Any help would be greatly appreciated.

0 Kudos
5 Replies
Kylie
by Esri Regular Contributor
Esri Regular Contributor

Hi Dakota -- Looks like your URL is missing the "featureSourceURL" parameter to specify what the URL is for. For example:

arcgis-collector://?itemID=0539f9d42f314b0587e5e5cd82587a5e&featureSourceURL=https://services9.arcgis.com/oYDccLD4RNQkDAu8/arcgis/rest/services/BMP_Collection_WFL1/FeatureServer...

Next, to get it to pass a parameter, you'll just need to add the featureAttributes parameter (keep in mind the attribute values need to be URL encoded).

You can see Deploy your map—Collector for ArcGIS | ArcGIS  for more about the Collector URL scheme, and some examples.

Esri Education Team
0 Kudos
DakotaHamilton
New Contributor

Thanks for the reply Kylie,

     It seems I made a mistake in typing my question and excluded the "featureSourceURL" parameter, I have edited my question to reflect what is in my Survey123 xls form: 

<a href="arcgis-collector://?itemID=0539f9d42f314b0587e5e5cd82587a5e&featureSourceURL=https://services9.arcgis.com/oYDccLD4RNQkDAu8/arcgis/rest/services/BMP_Collection_WFL1/FeatureServer...">Launch Collector</a>

This still fails to initiate a feature collection within the appropriate layer in Collector and I therefore cannot pass the parameter.

0 Kudos
Kylie
by Esri Regular Contributor
Esri Regular Contributor

What platform are you using Survey123 and Collector on? Does the URL work for you if you try just pasting it into a browser as opposed to using it through Survey123?

Esri Education Team
0 Kudos
DakotaHamilton
New Contributor

It does. The problem I was having was testing to see if the launch and parameter pass were working on my desktop but these were not supported on windows. Thus far I am able to pass an absolute parameter such as &featureAttributes={"BMP_ID":2} but am unable to pass one generated from the survey such as &featureAttributes={"BMP_ID":${bmpid}}. I am worried that it may be unsupported.

0 Kudos
Kylie
by Esri Regular Contributor
Esri Regular Contributor

OK I played with a few things. I assume your URL is on a note type field in your survey? The parameters work if you use a concat in the calculation field to create them. I made a survey that has a field named bmpid, and I added a field of type note with label "Click here:" and the following calculation: 
concat('<a href="arcgis-collector://?itemID=70a0e5a40cfa4cf0ad09b337284328f1&center=34.0547155,-117.1961714&featureSourceURL=https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0&featureAt...{bmpid},',%22name%22:%22Frank%22,%22requestdate%22:1502917218285%7D">Launch Collector</a>')

(this is using the sample URL from the Collector help, but modifying one of the parameters to using the bmpid value from the form).

It seems to be working for me, although I have noticed that you have to type in a bmpid value and then unselect that field before clicking the link to get that value passed to Collector (otherwise, the previous value of the field is passed).

Esri Education Team
0 Kudos