Select to view content in your preferred language

Preserve GlobalIDs when Appending from one hosted feature layer to another

544
4
06-05-2024 08:22 AM
Labels (1)
Caitlin_Todd_LCOR
Regular Contributor

Hello,

My team and I received a request from another department to take a copy of another organization's AGOL hosted Survey123 form, add some fields to it, and publish it to our own AGOL as a hosted Survey123 form. This survey contains several relationship classes based on GlobalIDs.

The hang-up is that they also requested all data to be regularly appended back into the other organization's hosted feature layer. The other organization has multiple editors for this survey so overwriting their service is out of the question.

Through some trial and error I discovered that within the Append tool, if you set it to preserve GlobalIDs, it will say it succeeded with warnings and "function not implemented" and no new rows in the table. Further searching online tells me that preserving GlobalIDs isn't supported for appending to a hosted feature layer.

I tried following the steps in this post. https://community.esri.com/t5/arcgis-online-questions/preserve-global-id-during-append-into-hosted/t... Down towards the bottom it gives instructions on how to append without overwriting the hosted feature layer. After downloading the map in Pro (step 3 of the link above) I can run the Append tool successfully and it preserves the GlobalID. But when trying to sync the map...nothing appears in the hosted feature layer.

So if the following statements are true:

1. Append cannot preserve GlobalIDS when applied against a hosted feature layer or any service.

2. GlobalIDs are required for the relationship classes to work.

3. Cannot overwrite the other organization's hosted feature layer for their Survey123 form. 

then I'm stumped on how to proceed. 

 

Has anyone else built a workflow where one hosted feature layer is appended into a different hosted feature layer without overwriting and while preserving GlobalIDs?

Many thanks, 

Caitlin

0 Kudos
4 Replies
MobiusSnake
MVP Regular Contributor

I've done this, but with Python.  There might be an easier no-code approach, but if not, this is what my script did:

  • Read the parent layer from the source data, copying each record to the target parent layer.  After the record is copied, a lookup table is populated with the original Global ID and the newly-assigned Global ID.
  • Read the child layer from the source data, copying each record to the target child layer.  As the record is being copied across, the lookup table from the previous step is used to find the new Global ID associated with the old Global ID.  The record is modified during this copy step so the parent ID is replaced with the new version.
  • This can be made recursive to handle multiple child layers, or "grandchildren".
  • A similar approach can be used to pull attachments across, but I think I used an OID lookup instead of a Global ID lookup (been a while since I did this).
0 Kudos
Caitlin_Todd_LCOR
Regular Contributor

@MobiusSnake  Thanks for replying. I was worried I'd have to go the python route since I'm not strong in my python skills. I apologize if I use incorrect terminology, but where did you run the script from? From Pro, or an AGOL Notebook, or somewhere else?

Thanks!

Caitlin

0 Kudos
MobiusSnake
MVP Regular Contributor

I ran it from an IDE (PyCharm, specifically) so that I could use debugging tools while I tested it.  Totally possible to run it from an AGOL notebook or Pro as well though.

0 Kudos
Caitlin_Todd_LCOR
Regular Contributor

Thanks! I'll run it by our programmers to see if they can help with this. 

0 Kudos