I could really use some help to understand what I'm doing wrong.I used Collector before but am new to Survey123. Initially I published a feature service with existing data, selected a feature in Collector, and opened Survey123 via pop-up/URL. While the survey fields were "pre-populated" correctly, submitting the survey would create a new feature instead of updating the existing one. My first question - is it possible to update existing features with Survey123, and if so what I might have missed?
It was at this point that I bumped into this thread. As a completely separate test I have been trying to make the related table approach work since yesterday, without much luck. Mostly I have been following Ismael's June 15, 2017 update and the Dec 7, 2017 "summary" by James. It seems I'm having issue with the GUID field (foreign key) of the related table. If it is added as a field to the survey, I got an error when trying to upload the survey, because that field is not editable. If it is not part of the survey, the survey can be uploaded, but when submitting survey data I run into a INSERT error again related to the same field, which I guess because no value is provided for it.
Details
+++++++++++++++++++++++++++++++++++++
Created the "asset" layer, created three features. Added and populated the "GlobalID" field (GUID).
Created a blank "Inspections" table, added a "GlobalID" field (GUID).
Created a relationship class (asset: Inspections, 1:M), with the respective "GlobalID" fields being the primary and foreign keys.
Published "asset"/"Inspection" as a feature service.
In Survey123Connect, created a survey against that service.
Changed "form_id" in the settings tab to "Inspections".
Deleted all questions related to fields of the "asset" layer from the survey - I noticed the generated survey didn't have any "GlobalID" field to being with.
Delete the two "repeat" lines from the survey.
If I don't add "GlobalID" to the survey, no matter whether I attach the "&field:GlobalID={GlobalID}" part to the pop-up URL or not, when submitting survey data I get this error: "Add error code 1000 - the INSERT statement conflicted with the FOREIGN KEY constraint "REL_FK_ASSET_INSPECTIONS_INSPECTIONS_0". The conflict occurred in database ..., column 'GlobalID' ".
If I add "GlobalID" to the survey as a text question, this was the error message I got when uploading the survey: "The custom feature service submission url is not compatible with this survey (Field GlobalID in Inspections is not editable)".
I see Chris' post above about storing the parent GUID passed by the URL in a separate/additional GUID field. So I added a separate GUID field ("parent_GlobalID", in additon to "GlobalID"), and used it instead of "GLobalID" (the foreign key) to hold the parent GlobalID passed via URL. I was able to upload the survey, but when submitting data I ran into the same INSERT error as above whether field binding is set to null or "esriFieldTypeGUID".
I then added another GUID field ("parent_GlobalIDorig") to "Inspections" and the survey. Field binding is set to null, and passed parent GlobalID into this field in the URL. Field binding for "parent_GlobalID" is set to "esriFieldTypeGUID" this time, and its calculation is set to:
if(string-length(${parent_GlobalIDorig})>36,substr(${parent_GlobalIDorig}, 1, string-length(${parent_GlobalIDorig}) - 1),${parent_GlobalIDorig})
Ran into the same INSERT error again.
The last thing I tried was to replace "parent_GlobalIDorig" with "GlobalID" in the survey. Once I do that I couldn't upload the survey, because "GlobalID" is not editable.