By default, when you publish a survey in Survey123, a feature layer is created using the schema from the survey. Alternatively, you can associate your survey with an existing feature layer.
Before creating a survey from an existing feature layer, the feature layer must be prepared for use with Survey123.
Generate a survey from a feature layer
Note:
This section describes functionality that is only available in Survey123 Connect. This functionality is not available in Survey123 Studio.
To generate a survey based on the schema of an existing feature layer, complete the following steps:
- Sign in to your ArcGIS organization, and click New survey.
- Choose the Feature services category.
- Browse to and select a feature layer.
The gallery shows layers that you have access to. Each tile includes a View item details option to open the item page and learn more about the layer or make necessary modifications.
- Click Create survey.
An XLSForm is generated from the feature layer. If the feature layer you chose has more than one layer, the survey is generated based on the first layer. To base a survey on another layer of the feature layer, you must author the survey manually and update the form_id and submission_url properties on the settings worksheet. For more information, see Author a survey that matches a feature layer.
If the feature layer you chose has attachments, a single image question will be created in the survey with the name <layer_name>_image. This name will not match a keyword in the attachments table and must be updated. If the existing attachments represent more than one question, you must add image questions to the survey to match each of the keywords in the attachments table.
- If the survey requires the following question types, manually add them after creating the survey:
- audio
- file
For more information, see Media questions. The feature layer must also have attachments enabled.
After the survey is created, you can publish the survey immediately or further customize it. For example, you can add more descriptive labels to the questions and arrange them in groups. When publishing a survey using an existing feature layer, a new hosted feature layer is not created for your form. Instead, the feature layer you selected will be referenced by your survey.
Author a survey that matches a feature layer
You can manually author a new survey that matches an existing feature layer, but you must update the form_id and submission_url properties on the settings worksheet to define a link between the survey and the feature layer's item in your portal or ArcGIS Online as follows:
- form_id—This property explicitly defines the name of the layer in the feature layer that is used by the survey. For more information, see the How do I author a survey that matches a feature service Knowledge Base article.
- submission_url—This property is the URL of the feature layer item. For example, the submission URL below is to an ArcGIS Online item:
https://www.arcgis.com/sharing/rest/content/items/21a6c530b31a4523bdff7gg94c9c5d9a
Tip:
You must provide the URL of the feature layer item as shown. A common mistake is to use the feature layer URL instead, which is not supported.
To create this URL, you must concatenate the Item ID with the portal Content Root. The submission URL for the same item in a portal looks like the following:https://<host>:<port>/arcgis/sharing/rest/content/items/21a6c530b31a4523bdff7gg94c9c5d9a
You don't need to add questions for every field in the layer. The only required fields are those that do not allow null values, in which case you must set required to yes for the question in the form. Question names must be the same as the field name; labels and display names do not need to match.
If you need a survey that requires some but not all fields of an existing feature layer, it is recommended that you generate a survey from the feature layer (as described in the previous section) and delete the questions that are not needed before publishing the survey. In this way, the form_id and submission_url properties are created automatically.