AnsweredAssumed Answered

How to add a new field to a Hosted Feature Layer?

Question asked by cmahlke_developer on Jun 6, 2020

Hi, I am trying to add a new field to a Feature Layer (hosted).  I thought that I could call the Add Field function.

 

Am I not passing in the correct parameters?

 

Here is my Notebook link (below):

Notebook Preview

 

Code snippet:

# Item: Salzburg Austria Feature Layerinput_data = gis.content.get("e52a0f35741e4eb0b87f8f1f499f26be")# Item's layertype(input_data.layers[0])
try:    arcpy.AddField_management(in_table=input_data.layers[0],                                field_name="Description",                                field_type="TEXT",                                field_precision="",                                field_scale="",                                field_length="50000",                                field_alias="")except arcpy.ExecuteWarning:    print(arcpy.GetMessages(1))except arcpy.ExecuteError:    print(arcpy.GetMessages(2))else:    print("Success!")finally:    print("Complete")

I receive back the following error:

RuntimeError: Object: Error in executing tool

Any suggestions on what I am doing incorrectly?

 

arcgis online notebooks arcgis notebooks beta

Outcomes