Select to view content in your preferred language

Issue in adding new field in hosted feature layer from client side JS code.

304
2
02-16-2024 04:53 AM
HardikVarshney
New Contributor

Hello,

I have hosted a feature layer which is a part of web-map for indoors, and I am trying to add a new field in the attributes table from the client side. For this I have created a new field using the ArcGIS "Field" constructor, added it to the layer's fields array, and then used the save() method, however this is not working for me.

 

Can someone suggest a solution for it or what am I missing in this process?

0 Kudos
2 Replies
BlakeTerhune
MVP Regular Contributor

I don't think it's possible to add a field to a hosted feature layer using the ArcGIS Maps SDK for JavaScript directly. You could possibly use the ArcGIS API for Python to create a geoprocessing tool that adds a field, host that geoprocessing tool as a geoprocessing service, then call that GP service from JS.

0 Kudos
HardikVarshney
New Contributor

Thank you @BlakeTerhune for your valuable response. 

I just wanted to confirm if this also applies to the renderer(wants to update the renderer). Could you please clarify?

0 Kudos