I have a MapServer layer in my ArcGIS Pro map with 60+ fields that all need aliases. The source is read-only (hosted on ArcGIS Enterprise), so I can't modify the schema directly.
I can edit aliases manually one at a time in the layer's Fields view, but that's tedious for this many fields. I wanted to script it.
Here's what I tried and what failed:
1. AlterField — fails because the source is read-only:
arcpy.management.AlterField(fc, "APN", new_field_alias="Assessor Parcel Number")
ERROR 000499: table is not editable
2. CIM fieldDescriptions — the standard approach from Esri's documentation:
lyr = arcpy.mp.ArcGISProject("CURRENT").activeMap.listLayers("parcel")[0]
cim = lyr.getDefinition("V3")
for fd in cim.featureTable.fieldDescriptions:
if fd.fieldName == "APN":
fd.alias = "Assessor Parcel Number"
lyr.setDefinition(cim)
This reported success, but the aliases never appeared in the Fields view or attribute table. On inspection, the CIM contained phantom field descriptions with a "1" suffix on every field name (e.g., APN1 instead of APN). These don't correspond to anything the UI reads.
Environment:
- ArcGIS Pro 3.x
- ArcGIS Enterprise 11.5
- Layer source: MapServer (workspace_factory: 'FeatureService')
Has anyone gotten batch alias updates to work on this type of layer?