If you cannot update the domain values in a hosted feature layer and cannot figure out why your schema is locked, you may have hosted feature layer views created with the Join Features tool (this may also occur on 'regular' views).
If this is the case, you can enable the ability to edit the source data schema by updating the service definition on all views (or at least all views that are causing the locking).
To do this, you must go to the update service definition admin REST endpoint for the View (not for the Hosted Feature Layer) and update the two attributes. When you look at the current service definition for the view you will find (maybe not in this order and may be not beside each other) that these will be set like so:
{
"hasStaticData" : true,
"sourceSchemaChangesAllowed" : false
}
You will want to update these attributes to the following:
{
"hasStaticData" : false,
"sourceSchemaChangesAllowed" : true
}
When using the update definition endpoint, remember that you need to also clear the editingInfo lastEditDate. Set it to this:
"lastEditDate" : ''
Once you have updated the definition for each of the views which are locking your layer, you should then be able to edit the source data domains, add fields, etc. Be careful not to edit anything that could break the view (deleting fields could be bad).
Once your schema is edited, you can re-set back to how ESRI expects your data to be by updating the view definitions with:
{
"hasStaticData" : true,
"sourceSchemaChangesAllowed" : false
}
The last time we did this (2023-02-17), the updated domains showed up automatically in the views. Nice to see this as I don't think it used to be this way.
n.b. while the hosted feature layer itself does also have the "hasStaticData" and "sourceSchemaChangesAllowed", you cannot (at this time) edit these in the hosted feature layer. They are controlled by the views.
post updated 2023-02-17
Farley