<?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 Change the name/display name of a GUID field /relationship in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-the-name-display-name-of-a-guid-field/m-p/1347424#M69195</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using this script to change the name/display name of a GUID field in AGOL using a notebook + the name and display name of a relationship. At the end, I get a message that the script was successful, but when I look at the fields in the table in the hosted feature layer, I dont see those changes. any idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;/P&gt;&lt;P&gt;# Connect to your ArcGIS Online organization or Portal for ArcGIS&lt;BR /&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;# Access the hosted feature layer&lt;BR /&gt;item = gis.content.get("223afb0dadeb432d9ab1a661e1a8116f")&lt;BR /&gt;feature_layer_collection = FeatureLayerCollection.fromitem(item)&lt;/P&gt;&lt;P&gt;# Access the specific table within the feature layer&lt;BR /&gt;table = feature_layer_collection.tables[0] # Adjust the index if there are multiple tables&lt;/P&gt;&lt;P&gt;# Change the name and display name of the GUID field&lt;BR /&gt;fields = table.properties.fields&lt;BR /&gt;for field in fields:&lt;BR /&gt;if field["type"] == "esriFieldTypeGUID" and field["name"] == "furnitureguid":&lt;BR /&gt;print("Found the field with the name 'furnitureguid' and type 'esriFieldTypeGUID'.")&lt;BR /&gt;print("Updating the name and display name of the field to 'landassetsguid'.")&lt;BR /&gt;field["name"] = "landassetsguid"&lt;BR /&gt;field["alias"] = "Land Assets GUID" # Modify the display name&lt;BR /&gt;# Convert the fields list to a dictionary&lt;BR /&gt;fields_dict = [dict(field) for field in fields]&lt;BR /&gt;try:&lt;BR /&gt;table.manager.update_definition({"fields": fields_dict})&lt;BR /&gt;print("Successfully updated the name and display name of the GUID field.")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"An error occurred while updating the field: {e}")&lt;/P&gt;&lt;P&gt;# Change the name and display name of the relationship&lt;BR /&gt;relationships = table.properties.relationships&lt;BR /&gt;for relationship in relationships:&lt;BR /&gt;if relationship["name"] == "Furniture":&lt;BR /&gt;print("Found the relationship with the name 'Furniture'.")&lt;BR /&gt;print("Updating the name and display name of the relationship to 'Land Assets'.")&lt;BR /&gt;relationship["name"] = "Land Assets"&lt;BR /&gt;relationship["name"] = "Land Assets" # Modify the display name&lt;BR /&gt;# Convert the relationships list to a list of dictionaries&lt;BR /&gt;relationships_dict = [dict(rel) for rel in relationships]&lt;BR /&gt;try:&lt;BR /&gt;table.manager.update_definition({"relationships": relationships_dict})&lt;BR /&gt;print("Successfully updated the name and display name of the relationship.")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"An error occurred while updating the relationship: {e}")&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py:703: UserWarning: You are logged on as Isabelle_B with an administrator role, proceed with caution.
  warnings.warn(&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE&gt;Found the field with the name 'furnitureguid' and type 'esriFieldTypeGUID'.
Updating the name and display name of the field to 'landassetsguid'.
Successfully updated the name and display name of the GUID field.
Found the relationship with the name 'Furniture'.
Updating the name and display name of the relationship to 'Land Assets'.
Successfully updated the name and display name of the relationship.&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 08 Nov 2023 21:10:29 GMT</pubDate>
    <dc:creator>IB3</dc:creator>
    <dc:date>2023-11-08T21:10:29Z</dc:date>
    <item>
      <title>Change the name/display name of a GUID field /relationship</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-display-name-of-a-guid-field/m-p/1347424#M69195</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using this script to change the name/display name of a GUID field in AGOL using a notebook + the name and display name of a relationship. At the end, I get a message that the script was successful, but when I look at the fields in the table in the hosted feature layer, I dont see those changes. any idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;/P&gt;&lt;P&gt;# Connect to your ArcGIS Online organization or Portal for ArcGIS&lt;BR /&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;# Access the hosted feature layer&lt;BR /&gt;item = gis.content.get("223afb0dadeb432d9ab1a661e1a8116f")&lt;BR /&gt;feature_layer_collection = FeatureLayerCollection.fromitem(item)&lt;/P&gt;&lt;P&gt;# Access the specific table within the feature layer&lt;BR /&gt;table = feature_layer_collection.tables[0] # Adjust the index if there are multiple tables&lt;/P&gt;&lt;P&gt;# Change the name and display name of the GUID field&lt;BR /&gt;fields = table.properties.fields&lt;BR /&gt;for field in fields:&lt;BR /&gt;if field["type"] == "esriFieldTypeGUID" and field["name"] == "furnitureguid":&lt;BR /&gt;print("Found the field with the name 'furnitureguid' and type 'esriFieldTypeGUID'.")&lt;BR /&gt;print("Updating the name and display name of the field to 'landassetsguid'.")&lt;BR /&gt;field["name"] = "landassetsguid"&lt;BR /&gt;field["alias"] = "Land Assets GUID" # Modify the display name&lt;BR /&gt;# Convert the fields list to a dictionary&lt;BR /&gt;fields_dict = [dict(field) for field in fields]&lt;BR /&gt;try:&lt;BR /&gt;table.manager.update_definition({"fields": fields_dict})&lt;BR /&gt;print("Successfully updated the name and display name of the GUID field.")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"An error occurred while updating the field: {e}")&lt;/P&gt;&lt;P&gt;# Change the name and display name of the relationship&lt;BR /&gt;relationships = table.properties.relationships&lt;BR /&gt;for relationship in relationships:&lt;BR /&gt;if relationship["name"] == "Furniture":&lt;BR /&gt;print("Found the relationship with the name 'Furniture'.")&lt;BR /&gt;print("Updating the name and display name of the relationship to 'Land Assets'.")&lt;BR /&gt;relationship["name"] = "Land Assets"&lt;BR /&gt;relationship["name"] = "Land Assets" # Modify the display name&lt;BR /&gt;# Convert the relationships list to a list of dictionaries&lt;BR /&gt;relationships_dict = [dict(rel) for rel in relationships]&lt;BR /&gt;try:&lt;BR /&gt;table.manager.update_definition({"relationships": relationships_dict})&lt;BR /&gt;print("Successfully updated the name and display name of the relationship.")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"An error occurred while updating the relationship: {e}")&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py:703: UserWarning: You are logged on as Isabelle_B with an administrator role, proceed with caution.
  warnings.warn(&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE&gt;Found the field with the name 'furnitureguid' and type 'esriFieldTypeGUID'.
Updating the name and display name of the field to 'landassetsguid'.
Successfully updated the name and display name of the GUID field.
Found the relationship with the name 'Furniture'.
Updating the name and display name of the relationship to 'Land Assets'.
Successfully updated the name and display name of the relationship.&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 08 Nov 2023 21:10:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-display-name-of-a-guid-field/m-p/1347424#M69195</guid>
      <dc:creator>IB3</dc:creator>
      <dc:date>2023-11-08T21:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name/display name of a GUID field /relationship</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-display-name-of-a-guid-field/m-p/1348375#M69220</link>
      <description>&lt;P&gt;Does this help?&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/update-definition-on-layer-in-feature-service/td-p/1067731" target="_blank"&gt;https://community.esri.com/t5/python-questions/update-definition-on-layer-in-feature-service/td-p/1067731&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 14:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-display-name-of-a-guid-field/m-p/1348375#M69220</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2023-11-11T14:24:05Z</dc:date>
    </item>
  </channel>
</rss>

