AnsweredAssumed Answered

Survey123 App Hangs when submitting survey

Question asked by roemhildtg on Mar 11, 2019
Latest reply on Apr 25, 2019 by dougbrowning

I'm running into an issue submitting a survey from the Windows survey123 app.

 

The FeatureService powering the survey is a ArcGIS Server service that has been added to arcgis online. The logfiles and the hanging message show that the error occurs on a layer that doesn't even participate in the survey.

 

The relevant error message shows:

<15>1 2019-03-11T18:17:20Z WSBLT-683 Survey123forArcGIS 14156 - [AppStudio@11205 category="qml" function="getNext" filename="XFormFeatureService.qml" line="994"] qml: Requesting layerInfo: https://utility.arcgis.com/usrsvcs/servers/.../pipeline_inspections/FeatureServer/28
<15>1 2019-03-11T18:17:20Z WSBLT-683 Survey123forArcGIS 14156 - [AppStudio@11205 category="qml" function="addLayerInfo" filename="XFormFeatureService.qml" line="1022"] qml: Feature layerInfo: {
  "advancedQueryCapabilities": {
    "supportsDistinct": true,
    "supportsOrderBy": true,
    "supportsPagination": true,
    "supportsQueryWithDistance": true,
    "supportsReturningQueryExtent": true,
    "supportsSqlExpression": true,
    "supportsStatistics": true,
    "supportsTrueCurve": true
  },
  "archivingInfo": {
    "startArchivingMoment": 1551457550000,
    "supportsQueryWithHistoricMoment": true
  },
  "capabilities": "Create,Query,Update,Delete,Uploads,Editing",
  "copyrightText": "",
  "currentVersion": 10.51,
  "dateFieldsTimeReference": {
    "respectsDaylightSaving": false,
    "timeZone": "UTC"
  },
  "description": "",
  "displayField": "contractorname",
  "editFieldsInfo": null,
  "fields": [
    {
      "alias": "objectid",
      "editable": false,
      "name": "objectid",
      "nullable": false,
      "type": "esriFieldTypeOID"
    },
    {
      "alias": "Service Type",
      "editable": true,
      "length": 255,
      "name": "servicetype",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Any route obstructions",
      "editable": true,
      "length": 255,
      "name": "routeobstruct",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Locates Marked",
      "editable": true,
      "length": 255,
      "name": "locatemarked",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Electric Meter installed",
      "editable": true,
      "length": 255,
      "name": "electricmeter",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Gas Meter Location marked",
      "editable": true,
      "length": 255,
      "name": "gasmetermarked",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Site is to grade",
      "editable": true,
      "length": 255,
      "name": "sitegrade",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Sewer Cleared",
      "editable": true,
      "length": 255,
      "name": "sewerclear",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Route flagged",
      "editable": true,
      "length": 255,
      "name": "routeflag",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Contractor name",
      "editable": true,
      "length": 255,
      "name": "contractorname",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Backbone service",
      "editable": true,
      "length": 255,
      "name": "backboneservice",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Inservice date",
      "editable": true,
      "length": 8,
      "name": "inservicedate",
      "nullable": true,
      "type": "esriFieldTypeDate"
    },
    {
      "alias": "Completion date",
      "editable": true,
      "length": 255,
      "name": "completiondate",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Gas Workorder Number",
      "editable": true,
      "length": 255,
      "name": "gasworknumber",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Electric Workorder Number",
      "editable": true,
      "length": 255,
      "name": "electricworknumber",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "Main workorder number",
      "editable": true,
      "length": 255,
      "name": "mainworknumber",
      "nullable": true,
      "type": "esriFieldTypeString"
    },
    {
      "alias": "globalid",
      "editable": false,
      "length": 38,
      "name": "globalid",
      "nullable": false,
      "type": "esriFieldTypeGlobalID"
    },
    {
      "alias": "Site Check ID",
      "editable": true,
      "length": 38,
      "name": "sitecheckglobalid_service",
      "nullable": true,
      "type": "esriFieldTypeGUID"
    }
  ],
  "globalIdField": "globalid",
  "hasAttachments": false,
  "htmlPopupType": "esriServerHTMLPopupTypeNone",
  "id": 28,
  "isDataVersioned": false,
  "maxRecordCount": 1000,
  "name": "NewService",
  "objectIdField": "objectid",
  "ownershipBasedAccessControlForFeatures": null,
  "relationships": [],
  "subtypeField": "",
  "supportedQueryFormats": "JSON, AMF, geoJSON",
  "supportsAdvancedQueries": true,
  "supportsApplyEditsWithGlobalIds": true,
  "supportsCalculate": false,
  "supportsRollbackOnFailureParameter": true,
  "supportsStatistics": true,
  "supportsValidateSQL": true,
  "syncCanReturnChanges": true,
  "type": "Table",
  "typeIdField": "",
  "types": [],
  "useStandardizedQueries": true,
  "parentRelationships": [],
  "childRelationships": []
}
<15>1 2019-03-11T18:17:20Z WSBLT-683 Survey123forArcGIS 14156 - [AppStudio@11205 category="qml" function="updateRelationships" filename="XFormFeatureService.qml" line="1180"] qml: Updating relationship for: Inspection
<12>1 2019-03-11T18:17:20Z WSBLT-683 Survey123forArcGIS 14156 - [AppStudio@11205 category="default" filename="XFormFeatureService.qml" line="1180"] qrc:/qml/XForms/XFormFeatureService.qml:1180: TypeError: Cannot read property 'name' of undefined
<15>1 2019-03-11T18:17:22Z WSBLT-683 Survey123forArcGIS 14156 - [AppStudio@11205 category="qml" function="expression for onStateChanged" filename="Portal.qml"

 

 

Looks like the relevant line in survey123 is:

 

Update: I did a little more digging and found a different version of survey123 that shows the error. Looks like the issue is caused when there is a table that participates in a relationship with another layer in the feature service in the table, but does not participate in a relationship with the main layer.  cc James Tedrick

    function updateRelationships() {
        function updateChildRelationship(childLayerInfo) {
            if (XFormJS.isNullOrUndefined(childLayerInfo.relationships)) {
                return;
            }

            var childRelationship;

            for (var i = 0; i < childLayerInfo.relationships.length; i++) {
                var relationship = childLayerInfo.relationships[i];

                if (relationship.cardinality === "esriRelCardinalityOneToMany" &&
                        relationship.role === "esriRelRoleDestination") {
                    childRelationship = relationship;
                    break;
                }
            }

            if (!childRelationship) {
                return;
            }

            var childKeyField = findField(childLayerInfo, childRelationship.keyField);
            if (!childKeyField) {
                console.error("Child keyField not found:", childRelationship.keyField);
                return;
            }

            if (childKeyField.type !== "esriFieldTypeGUID") {
                console.error("Unsupported childKeyField type:", childKeyField.type);
                return;
            }

            childRelationship.keyFieldInfo = childKeyField;

            var parentLayerInfo = layerInfos[childRelationship.relatedTableId];
            if (!parentLayerInfo) {
                return;
            }

            var parentRelationship;

            for (i = 0; i < parentLayerInfo.relationships.length; i++) {
                relationship = parentLayerInfo.relationships[i];

                if (relationship.id === childRelationship.id) {
                    if (relationship.cardinality === "esriRelCardinalityOneToMany" &&
                            relationship.role === "esriRelRoleOrigin") {
                        parentRelationship = relationship;
                        console.log("relationship:", parentRelationship.id, parentRelationship.name, "<==>", childRelationship.name);
                        break;
                    } else {
                        return;
                    }
                }
            }

            if (!parentRelationship) {
                return;
            }

            var parentKeyField = findField(parentLayerInfo, parentRelationship.keyField);
            if (!parentKeyField) {
                console.error("Parent keyField not found:", parentRelationship.keyField);
                return;
            }

            if (parentKeyField.type !== "esriFieldTypeGUID" && parentKeyField.type !== "esriFieldTypeGlobalID") {
                console.error("Unsupported parentKeyField type:", parentKeyField.type);
                return;
            }

            if (parentKeyField.type === "esriFieldTypeGlobalID" && !featureServiceInfo.supportsApplyEditsWithGlobalIds) {
                console.error("Feature service requires supportsApplyEditsWithGlobalIds for parent keyField type:", parentKeyField.type);
                return;
            }

            parentRelationship.keyFieldInfo = parentKeyField;

            console.log("child name:", childLayerInfo.name, "childRelationship:", JSON.stringify(childRelationship, undefined, 2));
            console.log("parent name:", parentLayerInfo.name, "parentRelationship:", JSON.stringify(parentRelationship, undefined, 2));

            childLayerInfo.parentRelationships[parentLayerInfo.name] = childRelationship;
            parentLayerInfo.childRelationships[childLayerInfo.name] = parentRelationship;

            if (parentKeyField.type === "esriFieldTypeGlobalID") {
                useGlobalIds = true;
            }

            return true;
        }


        for (var i = 0; i < layerInfos.length; i++) {
            var layerInfo = layerInfos[i];
            console.log("Updating relationship for:", layerInfo.name);
            updateChildRelationship(layerInfo);
        }

        return true;
    }

Outcomes