Preserve Global ID during append into hosted feature layer

1313
5
Jump to solution
09-09-2022 09:30 AM
PaulPetersen1
Occasional Contributor

Subject title says it all. I need to append data into an AGO hosted feature layer from a local fgdb using ArcGIS Pro. I just found out the hard way that the "Preserve Global ID" environmental setting does not work with AGO hosted services.

Is there another method or workaround?

This is really important, as I need to load an empty AGO schema and preserve GlobalID-based relationships.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Frequent Contributor

However, the preserve Global ID in append is honored when going the other way.

So, with "some" of my data (that overwriting doesn't break things), I append the data to a local database while preserving the Global ID's, then use that to overwrite the hosted layer.

Might help in some situations,

R_

View solution in original post

0 Kudos
5 Replies
KimOllivier
Occasional Contributor III

The only workaround that I see often is to create a ParentGUID GUID field and copy the GlobalID first. Then you have to change the foreign key GUID to the new GlobalID with an update.Maybe a python script or the Python API. This has also been driving me mad. The GlobalID is like an OBJECTID - not yours, so the software decides if the feature is a new record

0 Kudos
RhettZufelt
MVP Frequent Contributor

However, the preserve Global ID in append is honored when going the other way.

So, with "some" of my data (that overwriting doesn't break things), I append the data to a local database while preserving the Global ID's, then use that to overwrite the hosted layer.

Might help in some situations,

R_

0 Kudos
PaulPetersen1
Occasional Contributor

@RhettZufelt , oh ok, that could be viable. So you're saying that when I overwrite a service (and data) from Pro to AGO, if I have existing data with GlobalIDs enabled, the GlobalIDs will persist (not be regenerated) when overwriting into AGO? 

0 Kudos
RhettZufelt
MVP Frequent Contributor

I have created a hosted feature layer on AGOL using the "Publish Web Layer" in Pro as a Feature service with Global ID's enabled.

I can add features in the local database and these will get new Global ID's assigned, but the existing Global ID's are the same.  If I modify any existing features that already have Global ID, it will not change.

Now, if I then use Pro to "Overwrite Web Layer", it will replace the Hosted feature service on AGOL with the new, updated data, but any existing Global ID's in the local database will be preserved.

Of course, always best to test with a "test" dataset first just in case there are issues. (this is ESRI afterall)

R_

0 Kudos
willbruce_KarukTribeDNR
New Contributor III

The simplest workaround I have found (working as of 04/2024, does not require overwriting the service):
1. Service must have sync enabled.
2. Add service to a new map in ArcGIS Pro.
3. Use 'Download Map' to create a local copy of the service.
4. Set up the Append tool, and enable "Preserve GlobalIDs" in environment settings. The local copy is stored in a mobile geodatabase, which supports this setting. As OP notes, using this setting to directly apply edits to the service will fail.
5. Verify that the append succeeded and GlobalIDs match between the source and target.
6. Sync the map. Edits are applied to service, without change to GlobalID.

0 Kudos