Add Highlight option to "Alter Field (Data Management)" tool

148
0
02-06-2024 08:35 AM
Status: Open
Labels (1)
Matthew_Muehlhauser
New Contributor III

The Alter Field (Data Management) geoprocessing tool should allow an option to highlight the field. There should be a "field_is_highlighted" option that you can set to true to highlight the field when used through arcpy.

Currently, to highlight a field through arcpy, you have to do it through the cim, however; the cim.featureTable.fieldDescriptions is often an empty array. So any attempt to automatically and quickly change the property will end up failing.

Instead, you end up having to run the "Alter Field" data management tool and apply something that will result in a net 0 change, e.g.:
arcpy.management.AlterField(lyr, "SHAPE", clear_field_alias=True)

That will populate the fieldDescriptions array and then you can run through the array and update the field's highlight property in the cim and then update the lyr's definition. However; this takes extra steps, and it would be nice to just go:

arcpy.management.AlterField(lyr, "FIELD_TO_HIGHLIGHT", field_is_highlighted=True)