I have a feature class that I maintain in a geodatabase that has editor tracking enabled. It has the standard fields: created_user, created_date, last_edited_user and last_edited_date. I'm using the python functions in arcpy.mp to create the SD draft and to stage the definition file. Then using the ArcGIS API for Python to update and publish the SD file in AGOL.
When I publish my map, all values in my editor tracking fields get overwritten with the date/time the script runs and the username that I use to login to AGOL. If I choose to make those fields not visible in my Pro project, then no data appears in my updated service. This happens despite having editing capabilities disabled.
Is there a way to prevent this overwrite from happening? I would like the tracking information to reflect what I have in my geodatabase.
Best,
Leon
Hi Leon,
You can preserve editor tracking when making the publish call to the rest API and adding the property: preserveEditUsersAndTimestamps example:{"editorTrackingInfo":{"enableEditorTracking":true,"preserveEditUsersAndTimeStamps":true}}
This documentation will help: ArcGIS REST API
I'm not as familiar with the ArcGIS Python API, but it looks like you should be able to add the above information as a publish)parameter when using publish: arcgis.gis module — arcgis 1.0 documentation
Here is a link to a similar script that maintains editor tracking when publishing from a FGDB by making direct REST API calls: http://cloudygis.maps.arcgis.com/home/item.html?id=2d7027b148e24005916e55ab2cb74b50
Feel free to share your code if you have questions on how to implement this.
-Kelly