<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Invalid definition for 'LastEditDate' when using layer.manager.update_definition(layer.properties) to change field aliases in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1617433#M11412</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/844882"&gt;@sandra555&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You need to use the actual name of the field and update the alias. You are using layer.properties in the update to update ALL properties, you only want to update the fields property. Try below and let us know how you get on.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

## access ArcGIS Online
agol = GIS("home")

## get the Feature Service as an Item object
fs_item = agol.content.get("FS_ITEM_ID")

## get the Feature Layer as a FeatureLayer object
layer = fs_item.layers[0] # 0 is the first layer in the feature service

## define the field dictionary
rename_field_dict = {
    "name" : "THE_FIELD_NAME_TO_UPDATE_ALIAS_FOR",
    "alias" : "HOW_I_WANT_THE_FIELDNAME_TO_BE_DISPLAYED"
}

## apply the update to the fields property
layer.manager.update_definition({"fields" : [field_dict]})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 May 2025 10:09:08 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2025-05-22T10:09:08Z</dc:date>
    <item>
      <title>Invalid definition for 'LastEditDate' when using layer.manager.update_definition(layer.properties) to change field aliases</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1616553#M11405</link>
      <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exception: Unable to update feature service layer definition.&lt;BR /&gt;Invalid definition for 'LastEditDate'.&lt;BR /&gt;Invalid definition for ESRI.ArcGIS.SDS.Metadata.EditingInfo&lt;BR /&gt;(Error Code: 400)&lt;/P&gt;&lt;P&gt;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!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;rename_fields_dict = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;'name': 'Station/Location of Site'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;item_id = 'b343dc10f4b4458cbf0eb5a5e5a51234'&lt;BR /&gt;fs_item = gis.content.get(item_id)&lt;BR /&gt;layer = gis.content.get(item_id).layers[0]&lt;BR /&gt;field_defs = layer.properties["fields"]&lt;BR /&gt;str_field = str(field)&lt;BR /&gt;for field in field_defs:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; display_name = rename_fields_dict.get(str_field, '')&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if display_name != '':&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; field["alias"] = display_name&lt;/P&gt;&lt;P&gt;layer.manager.update_definition(layer.properties)&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 17:06:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1616553#M11405</guid>
      <dc:creator>sandra555</dc:creator>
      <dc:date>2025-05-20T17:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid definition for 'LastEditDate' when using layer.manager.update_definition(layer.properties) to change field aliases</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1617433#M11412</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/844882"&gt;@sandra555&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You need to use the actual name of the field and update the alias. You are using layer.properties in the update to update ALL properties, you only want to update the fields property. Try below and let us know how you get on.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

## access ArcGIS Online
agol = GIS("home")

## get the Feature Service as an Item object
fs_item = agol.content.get("FS_ITEM_ID")

## get the Feature Layer as a FeatureLayer object
layer = fs_item.layers[0] # 0 is the first layer in the feature service

## define the field dictionary
rename_field_dict = {
    "name" : "THE_FIELD_NAME_TO_UPDATE_ALIAS_FOR",
    "alias" : "HOW_I_WANT_THE_FIELDNAME_TO_BE_DISPLAYED"
}

## apply the update to the fields property
layer.manager.update_definition({"fields" : [field_dict]})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 10:09:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1617433#M11412</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-05-22T10:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid definition for 'LastEditDate' when using layer.manager.update_definition(layer.properties) to change field aliases</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1617491#M11413</link>
      <description>&lt;P&gt;Hi Clubdebambos, Thanks for your example. I have it working now!&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 14:16:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/invalid-definition-for-lasteditdate-when-using/m-p/1617491#M11413</guid>
      <dc:creator>sandra555</dc:creator>
      <dc:date>2025-05-22T14:16:08Z</dc:date>
    </item>
  </channel>
</rss>

