By default, when you publish a survey in Survey123, a feature layer is created using the schema from the survey. Alternatively, you can choose to associate your survey with an existing feature layer.
Prepare a feature layer
To use an existing feature layer with Survey123, it must meet the following requirements:
- The feature layer must be an item in ArcGIS Enterprise or ArcGIS Online. This includes hosted feature layers and feature layers published to federated and nonfederated servers.
Note:
To work with nonfederated feature services, additional configuration is required. You must manually create a feature layer item in your ArcGIS organization that represents the service. For details, see the Knowledge Base article on how to connect to nonfederated ArcGIS Server services.
- The owner and users of the survey must have access to the feature layer.
- The feature layer must be editable.
- The following additional properties must be set to true:
- supportsApplyEditsWithGlobalIds—The feature layer must support applying edits with global IDs. This allows the app to create and manage the global IDs in created features (as opposed to the server creating a new global ID for created features).
- supportsAttachmentsByUploadId—This property is automatically turned on when enabling attachments on the feature layer. It allows the app to upload all attachments associated with a survey before submitting the survey. If any of the attachments fail, the entire survey submission rolls back, preventing data loss.
Depending on the survey design and how the survey will be used, consider the following additional requirements:
- For users to collect new surveys to add records, the Create capability is required.
- For users to edit existing survey records:
- The Update capability on the layer is required.
- Ensure that either the feature layer allows null values or the 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 layer that doesn't permit null values.
- For users to submit images, audio, or files, enabling attachments is required (set hasAttachments to true).
- Repeats in a survey cannot reference related layers or tables unless the child layer or table uses a GUID field for the relationship. The name of the repeat will be defined by the table name of the related table or layer and cannot be changed.
Note:
Survey123 only supports one-to-many GUID relationships when working with existing feature layers and related tables. One-to-one relationships are not supported.
Applying edits with global IDs
For a feature layer to support applying edits with global IDs, the following requirements must be met:
- The layers in the feature layer must have a GlobalId column with a unique index. The best way to do this is to enable sync when publishing the feature layer.
- If using a multiuser geodatabase, layers can use branch versioning but not traditional versioning. Survey123 will target the default version when using a branch versioned geodatabase. For more information, see Versioning types.
- If the feature layer contains m-enabled layers, editing without m-values must be enabled.
- Global IDs must exist in a feature layer or table before enabling attachments on either.
For more information on supporting editing in a feature layer, see supportsApplyEditsWithGlobalIds in Layer (Feature Service) in the ArcGIS REST API documentation.
Enabling attachments
When enabling attachments on a feature layer, the KEYWORD and EXIFINFO columns are not added to the schema by default. This column is needed to be able to associate attachments with the correct record. After enabling attachments, run the Upgrade Attachments Geoprocessing tool to enable keywords.
Note:
It's recommended that the KEYWORD and EXIFINFO columns are added before collecting records with Survey123 so that all attachments that are submitted have keywords. If the KEYWORD and EXIFINFO columns do not exist before attachments are submitted, the Update Attachment Keywords Python notebook can be used to update attachments.
Modify schema
Once a survey has been created from an existing feature layer, new questions and choice list values can be added to the survey only after the corresponding field or domain is added to the feature layer. When a survey is created from a feature layer view, new questions and choice list values can be added to the survey only after the corresponding field or domain is added to the underlying feature layer and has been propagated to the feature layer view.