By default, when you publish a survey in Survey123 Connect for ArcGIS, a feature service is created using the schema from your survey.
Prepare a feature service
To use a feature service with Survey123, it must be a hosted service from ArcGIS Enterprise or ArcGIS Online, or a service from ArcGIS Server (10.3.1 or later) that is federated with Portal for ArcGIS.
The owner and users of the survey must have access to the feature service.
Repeats cannot reference related layers or tables unless the child layer or table uses a GUID field for the relationship. If using ArcGIS Server 10.3.1, repeats cannot work with related layers or tables unless the relationship uses a GUID field for the relationship in the parent layer. Although not a requirement in later versions of ArcGIS Server, best practice is to use a GUID field for the relationship in the parent layer. The feature service must support applying edits with global IDs.
If you plan to edit your surveys, ensure that either your feature service allows null values or your survey uses required fields. Survey123 uses null values in editing when an answer is deleted and is not replaced; consequently, Survey123 will not submit a survey from a feature service that doesn't permit null values.
For a feature service to support applying edits with global IDs, the following requirements must be met:
- The layers in the feature service must have a globalid column with a unique index. The easiest way to do this is to enable sync when publishing your feature service.
- The data cannot be versioned.
For more information on how to support editing in your feature service, see supportsApplyEditsWithGlobalId in Layer (Feature Service) of the ArcGIS REST API documentation.
To work with nonfederated feature services, some additional configuration is required, as you will need to manually create a feature layer item in your ArcGIS organization that represents the service. For details, see this knowledge base article on how to connect to nonfederated ArcGIS Server services.
Generate a survey from a feature service
The quickest way to create a survey that is linked to an existing feature service is to generate the survey from the feature service in Survey123 Connect for ArcGIS.
In Survey123 Connect, choose New Survey, sign in to your ArcGIS organization, and select the Feature Services category. Browse to and select the desired feature service and click Create Survey. An XLSForm will be generated from your feature service. You can then publish this survey immediately or further customize it. For example, you can add more descriptive labels to the questions or group them into sections.
Surveys cannot be generated from public services.
If the survey you're creating requires image or audio questions, these will need to be added to your survey manually. After generating the survey, open the spreadsheet and add the questions. For more information, see Media. The feature service must also have attachments enabled.
Author a survey that matches a feature service
It is also possible, but not recommended, to author a new survey that matches an existing feature service. If you require a survey that does not include all the fields of an existing feature service, it is recommended to generate a survey from the feature service (as described above) and delete any of the questions that are not needed before publishing the survey. You will also need to use the submission_url property on the Settings tab of your spreadsheet to define a link between your survey and the feature layer's item in your portal or ArcGIS Online.
You need to provide the URL of the feature service item, as seen above. A common mistake is to use the feature service URL instead, which is not supported.
You also need to fill in the form_id property, a value that explicitly defines which layer is used by the survey. For details, see this knowledge base article on how to author a survey that matches a feature service.