I've got a hosted feature layer in which I am the owner. I'd like to edit one of the domains to one of the tables, but when I click in the "Data-->Fields" tab,k and then select the field of interest, I am not given any option to edit the domain. I also noticed that I cannot add or remove attribute fields.
Usually I am able to do this in AGO without issue, so I'm a little baffled. The service is being used in a webmap and dashboard app, and also as an embedded Survey123 form in the dashboard app. I do have one of the tables participating in hosted (join) view, but not the table that I'm trying to edit.
See screenshot below for current feature layer setting. Am I missing something?
Editing domains can be tricky. Are you trying to apply this to the main layer, or a view that was created?
For some of my hosted layers, I've only been able to edit the domain by editing the JSON directly, which can be a bit more advanced.
It's the main feature layer...a non-spatial sublayer within the feature layer. Not a view.
That's a good thought on editing the JSON. I do I go about doing that? I just checked it out on the ago-assistant, but the domains are not exposed.
I forgot to ask: is this on Portal, or AGOL? On Portal, you can use the Server Admin tool. Otherwise, you'll have to use something like the Python API.
# connect to portal
from arcgis import GIS
gis = GIS('your portal url', 'user')
# get featurelayer
fl = gis.content.get('itemid of your service').layers[0]
# pull out layer's json for your fields
json = fl.properties['fields']
# you'll need your field's index here.
# if you don't know it, you can get a list of field names and their respective indices first
# print({x['name']:json.index(x) for (x) in json}
# let's just pretend yours is at index 5
# append new code / value to domain
json[5]['domain']['codedValues'].append({'code':'newcode', 'name':'newname'})
# apply updated json to service
fs.manager.update_definition({'fields':json})