Pass Global ID from Collector to G

7566
31
01-25-2018 07:24 AM
KevinKozak
Occasional Contributor

Has anyone been able to pass the Global ID from a service in Collector to the related GUID in Survey123 using the URL method?

I have a database relationship of Bridges to Inspections. In addition, Inspections have related Elements. Since Survey123 can only go two deep in relationships I have a service for Bridges in Collector and the Inspections and Elements in Survey123. I have created the Survey123 from the Inspection and Element service.

31 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Kevin,

What you're asking for is possible.  You would need to configure the Bridges layer's pop-up to have a url that includes the GlobalID in the parameters; this is described in Integrate with other apps—Survey123 for ArcGIS | ArcGIS and https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-sche... .  This would go into a hidden field.

There is a known issue with Survey123 receiving the globalid value - it can't process the value if it already has curly braces ( { } ).  To get around that, the survey should be designed with 2 fields to handle the globalid value:

  • The first field (let's cal it "incoming") should be a hidden field (or text, if you want to validate that it's receiving the value) that has a fieldType null (so it isn't submitted to the database.  In your case, using an existing feature class, this would be added if you have Survey123 create a form based on the feature class
  • The second field (parentglobalid) will hold the value, minus any curly braces.  This can be a calculate (or again, text for validation checks) question with a formula like:
if(regex(${incoming}, '^\{[\w\-]*\}$'), substr(${incoming},1, string-length(${incoming}) - 1), ${incoming})

The regex detects if the guid is formatted as {1080901b-c30d-411b-a485-151c8f6ad8e6}, if the braces are present, it extracts the portion between the braces, otherwise it passes the guid unaltered.  The field type should by of esriFieldTypeGUID.

See the attached sheet for an example of this pattern.

KevinKozak
Occasional Contributor

Hello James,

I appreciate your response. I read the articles you provided, they were informative. Being an old GIS dog trying to learn new tricks, I still have some questions.

  • My goal is to maintain the relationship class between the Bridge service’s GlobalID and the Bridge GUID in the Inspection service. If I have created the survey by importing the Inspection service schema, which has the Bridge GUID already and cannot be seen in the survey as a question, how would I list this existing GUID as a question? Documentation says that reserved fields in a feature layer are not added to the XLSForm, which GloabalID is a reserved word. Adding such a field with the same name would seem to change the Inspection schema and create a new service. Your example calls this the “theguid” in the XLSForm.
  • How does a GlobalID and GUID work if the curly brackets are removed?

Below is my thought process based upon your suggestions.

  • Bridge feature service has GlobalID field.
  • Inspection feature service has a GlobalID and brdg_guid fields.
  • In the Survey123 form have the following questions added:
    • brdg_guid_txt as type null
    • brdg_guid as type esriFieldTypeGUID and the calculation for the regex statement
  • Have Collector Bridge popup as: arcgis-survey123://?itemID=fe06d025e41a4ceabdb3dd1ba15713c6&field: brdg_guid ={GlobalID}

Thank you for your help,

Kevin 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Kevin,

  • When Survey123 creates a form based on an existing feature service, it omits the GlobalID and GUID fields as the form rendered (including bridges and inspections) would automatically manage the relationships.  When switching to a URL-launched survey, we go from automatic management to manual management.  You need to manually add the ParentGUID question manually to accommodate this.
    From the question, are you planning to edit the Bridge layer when being launched by a hyperlink?  This is currently not supported; opening the app by hyperlink is supported for add only (Inspection form)
  • Survey123 supports fields with a bind::Esri:fieldType of null - this means that a question will not be submitted and has no effect on the table schemas
  • The curly braces are added automatically by Survey123, which is why they need to be removed

The URL as you've specified looks to be appropriate for what you're describing.

0 Kudos
ChrisBlinn1
Occasional Contributor

Can the incoming and parentglobalid fields be hidden? When I set the type to hidden, it doesn't populate the parent GUID.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Christopher,

Yes the fields can be hidden.  I will note that the workaround of having 2 different fields to normalize is no longer needed.  Make sure the hidden parentglobalid question has an esrifieldtype of esriFieldTypeGUID.

0 Kudos
ChrisBlinn1
Occasional Contributor

So remove the regex as well?

0 Kudos
ChrisBlinn1
Occasional Contributor

Update: I was able to get this working with a hidden parentglobalid field - thanks James!

0 Kudos
JosephGrossman
New Contributor III

Hi James, 

Thank you for all your advice throughout these forums. I am trying to create polygon, line or point features that collects a location and information in collector, than using the custom URL scheme pass the GlobalID and some information to a more detailed survey with repeats.

I wanted this Survey to publish data to the same feature service (different feature class and table) of the original feature so it can be related to the survey results in AGOL. I was able to make this work creating relationship files and publishing the Survey123. I was able to create the custom url and pass the global ID through to survey123 using the "if(regex(${incoming}, '^\{[\w\-]*\}$'), substr(${incoming},1, string-length(${incoming}) - 1), ${incoming})" formula.

My tests have shown that it works though the windows web interface and on IOS, but it will not pass the GlobalID though using Android. I am on Android 9 using the "Collector for ArcGIS" and Collector (BETA), as well as using Survey123 (4.1) as well as Survey123 (Classic). Any advice? Thanks! Joe

0 Kudos
ShanaGail1
Occasional Contributor

Oh nooo...  I had totally missed this issue of not being able to edit an existing feature using Survey123.  I had plans to incorporate this into the workflow for 2 different projects and need to come up a plan B quickly.  We really wanted to have the field inspector fill out a Survey.  Is there an elegant workaround?  Is the functionality in a project plan? 

Thanks,

Shana

0 Kudos