How to enable editor tracking with existing fields

798
6
01-16-2019 12:06 PM
RanjitChaturvedi
New Contributor II

Hi Everyone,

When we enable editor tracking, ESRI creates the created_user,created_date, last_editor,last_edited_date, However, we want to point it to a different field defined in our data model like creator, creation_date, lastuser, lastmodified. PResently there is a manual process to manually going to the properties> Enable Editor Tracking> map the fields. We have a lot of data to run this manual process. Is there any python screen, tool or any other way to enable editor tracking with fields other than the Esri defined fields.

Thank you.

Regards,

Ranjit 

GIS Solution Architect

0 Kudos
6 Replies
MitchHolley1
MVP Regular Contributor

If the feature classes in your geodatabase have the same field names that can be used for the tools input, you can run something like what's listed below.  You can list the feature classes in the database, iterate over them and enable ET on each feature class.

There is also a script on the arcgis website that would work. Enable Editor Tracking—Help | ArcGIS for Desktop 

import arcpy

database = r'path/to/database'

#set workspace
arcpy.env.workspace = database

#list of fields
creator = 'creator'
create_date = 'create_date'
last_editor = 'last_editor'
last_edit_date = 'last_edit_date'

#list featureclasses in database
featureClasses = arcpy.ListFeatureClasses()

#iterate over featureclasses and enable
#editor tracking based on fields above
for fc in featureClasses:
    arcpy.EnableEditorTracking_management(creator,
                                          create_date,
                                          last_editor,
                                          last_edit_date)

    print ("Editor tracking enabled for: {}".format(fc))‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
RanjitChaturvedi
New Contributor II

Can we map the fields to 

creator, creation_date, lastuser, lastmodified

rather than Esri defined fields?

0 Kudos
ericmcdonough
New Contributor

i am using a script to enable editor tracking of all feature classes of many datasets.  it works for a bit but then i get "ERROR 001278: Field does not exist....." The fields DO exist, just as they do in the feature classes in which the script works. I don't know why it gets hung up. 

0 Kudos
Asrujit_SenGupta
MVP Regular Contributor

Use the "Enable Editor Tracking" tool (Script it out if required):

ArcGIS Pro: Enable Editor Tracking—Data Management toolbox | ArcGIS Desktop 

ArcGIS Desktop: Enable Editor Tracking—Help | ArcGIS Desktop 

deleted-user-T2vl0rIewI4H
New Contributor II

Be aware that there are some scenarios where the tool/python gp task fails

See posting from  @HarlenMarshallEnable Editor Tracking tool does NOT work 

RanjitChaturvedi
New Contributor II

Yes, its pretty inconsistent

0 Kudos