Hi, I am trying to use the API to change the display name of the fields in my feature layer. I am getting the following error.
Exception: Unable to update feature service layer definition.
Invalid definition for 'LastEditDate'.
Invalid definition for ESRI.ArcGIS.SDS.Metadata.EditingInfo
(Error Code: 400)
I tried a couple of things I found online to get rid of this error, but was not successful in solving the problem. I read that the LastEditDate must be set to Null, but I do not know where that is stored or how to update it. Thanks in advance for assistance!
Here is my code:
rename_fields_dict = {
'name': 'Station/Location of Site'
}
item_id = 'b343dc10f4b4458cbf0eb5a5e5a51234'
fs_item = gis.content.get(item_id)
layer = gis.content.get(item_id).layers[0]
field_defs = layer.properties["fields"]
str_field = str(field)
for field in field_defs:
display_name = rename_fields_dict.get(str_field, '')
if display_name != '':
field["alias"] = display_name
layer.manager.update_definition(layer.properties)