AnsweredAssumed Answered

InsertCursor return GlobalID

Question asked by smithc on Feb 6, 2018
Latest reply on Feb 11, 2018 by smithc



Is there any way using a arcpy.da.insertCursor for it to return a GlobalIID rather than the OBJECTID? 


My script is adding data to a number of feature classes and tables that are all tied together with relationship classes using GlobalID's and keys. The purpose of my script is to normalise some data in a table that has been captured with Survey123.


Currently my workflow is as follows


1. Create a edit session

2. Create InsertCursors for all my tables.

3. Loop through my input adding records to the necessary tables. After Each insert I get the OBJECTID and then create a SearchCursor on the same table with the OBJECTID as the where. I then extract the GlobalID from the record in the search cursor.

4. delete Insert Cursors

5. Stop editing and Commit.


This approach works for some of my tables but not for others? My guess there is some kind if issue / bug when triggering a search cursor on a table that is in edit mode on a record that has just been added and not committed?


Is there a better approach for this to get a GlobalID from a record that has just been inserted?  I don't want to have to stop editing after each insert to create a SearchCursor get the GlobalID as this will potentially be slow.