HOW TO
It is not possible to have ObjectID as a question when publishing a survey. Whether publishing a new survey, or using a submission URL to an existing feature service, publishing can not be performed and an error is returned, as seen in the image below:
Unable to edit feature service definition.
This is expected since the ObjectID field is essentially a non-editable field. Additionally, the ObjectID is only created after submitting a form.
However, it may be necessary to use the ObjectID of existing submissions on the form. For example, to append the ObjectID to a URL to create a link to send a query request, or generate a link to a Survey123 website and select a submission using the ObjectID parameter, as shown in the next image.
There is a workaround that enables pulling the ObjectID of existing features and passing it to a field on the form and using it in calculations when editing existing survey submissions. To do this, add a question (with text or integer type) to show ObjectIDs. The name for this field should match the name of the ObjectID field of the feature layer (this is case sensitive). It is also necessary to set the bind::esri:fieldType to null.
Survey questions with null fieldTypes do not need to have a corresponding field in the attribute table of the survey's hosted feature layer, that is why the Unable to edit feature service definition error is no longer returned when trying to publish the survey from Survey123 Connect. Additionally, the answers submitted for a question with null field type are not stored in the feature layer since there is not a field for that question. This is not exactly the case for the ObjectID question in this scenario. Although this question has a fieldType of null in the survey's XLS form, the feature layer has an ObjectID field which is a non-editable field. Therefore, when filling out the form, regardless of the user input for the objectid question, a new ObjectID (which is a sequential number starting from 1) is assigned to the submitted feature. The purpose of having the ObjectID question in the survey here is not to collect data to a field or assign a custom ObjectID to a new feature, rather it is accessing the ObjectID for a feature when editing existing records. Therefore, to avoid confusion for the user, it is best to flag the ObjectID question as read-only in the XLS form.
The image below shows an example of a question with the properties mentioned above in a sample survey:
Now when collecting new data via the survey form, the ObjectID question is read-only and is submitted with no input from the user. However when editing the same record via the Inbox in the Survey123 field app or using edit mode in the Survey123 web form, the ObjectID question shows the ObjectID for the existing feature. The image below compares the ObjectID question on the survey form when adding a new submission, and when editing an existing record.
The image below shows the same behavior when editing and existing record in Survey123 web for where the objectid question is populated with the ObjectID of the selected feature.
Get help from ArcGIS experts
Download the Esri Support App