Hello,
I would like to edit the Editor of a Feature in a Layer in a published Feature Class. I run the script but AGOL does nothing, also, I get no errors.
I am asking myself possible problems:
- The field Editor is always written protected, is that the problem? ( Screenshot:
) - Should I modify the attribute in the Feature-Class instead of in the Layer?
My code:
PolygonOnlineId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
PolygonOnline = gis.content.get(PolygonOnlineId)
PolygonOnlineLayer = PolygonOnline.layers[0]
PolygonOnlineLayerFSet = PolygonOnlineLayer.query()
PolygonOnlineLayerFSetFeatures = PolygonOnlineLayerFSet.features
for f in PolygonOnlineLayerFSetFeatures:
if f.attributes['Editor']=='xyz': #the script finds the features with editor == xyz
fEdit = f
fEdit.attributes['Editor'] = 'yyyy' #the scripts changes nothing!
update_result = PolygonOnlineLayer.edit_features(updates=[fEdit])
print("Editor changed!")
else:
print("editor not changed")
Print("Done")