The idea is to have a function in Pro / Python to refresh the field descriptions for a layer.
Function on a layer: Refresh fields from datasource, this loads all fields from the datasource and replaces the current custom fields description.
The use-case: I need to change the datasource of a layer and I want to refresh the fields information (Names, Aliasses and order etc.). At this moment this option is not available and I have to create a new layer and copy the style, scales, displayname and layrid from the old layer.
Now I have to do this, which is slow on ApplySymbologyFromLayer. I would like to have fast option like: layer.refreshFields()
layer = arcpy.management.MakeFeatureLayer(viewpath, layername)[0]
arcpy.management.ApplySymbologyFromLayer(layer, oldlyr, None, "MAINTAIN")
layerdef = layer.getDefinition('V2')
layerdef.minScale = minScale
layerdef.maxScale = maxScale
layerdef.serviceLayerID = layerid
oldlayerdef = oldlyr.getDefinition('V2')
layerdef.featureTable.displayField = oldlayerdef.featureTable.displayField
print(f'Displayfield: {layerdef.featureTable.displayField}')
layer.setDefinition(layerdef)
m.moveLayer(oldlyr, layer, 'AFTER')
m.removeLayer(oldlyr)
print('Layer Done')