Update Hosted Feature Service Schemas in ArcGIS Online not working

1577
2
Jump to solution
06-19-2019 07:56 AM
Thomas_Z1
New Contributor III

Following this instructions (How To: Add coded value domains to a hosted feature service from a REST endpoint), I can successfully add a new coded value domain to a layer's field.

/* ... (pseudo JSON) */
{
    "name" : "pipeType", 
    /* ... */
    "domain" : {
      "type" : "codedValue", 
      "name" : "hydrantType", 
      "codedValues" : [{
          "name" : "Private", 
          "code" : 1
        },{
          "name" : "Public", 
          "code" : 2
        }]
    }, 
    "defaultValue" : null /* <--- change this to 2 */
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
/* ... */‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

However, when changing the default value (e.g. null to 2; my field is a short integer), that change will be ignored but no errors or warnings occur. Furthermore, when doing both, adding a new coded value domain and changing the default value, the coded value domain is successfully added and the default value is being ignored. Is this a bug or do I miss something?

0 Kudos
1 Solution

Accepted Solutions
Egge-Jan_Pollé
MVP Regular Contributor

Hi Thomas Zuberbuehler,

I don't think this is a bug, but rather a case of "The application works as designed", as Esri developers, or any developer for that matter, tend to say in cases like this. You cannot change this default value in this way, so the REST endpoint silently refuses to apply your change (without returning a message).

And it is even worse... I will explain. As you might have read:

As of the June 2018 update to ArcGIS Online, domains can be added and updated directly in ArcGIS Online through the Data tab in the hosted feature layer's item page.

And if you go to this Data tab on the item page, you will see that you can edit the List of Values (Domain), but you can only see - but not edit - the Default Value (see screen capture below).

I guess you have to set this default value during the design of the Feature Class (in ArcGIS Desktop?).

HTH,

Egge-Jan (a fellow Esri user)

View solution in original post

2 Replies
Egge-Jan_Pollé
MVP Regular Contributor

Hi Thomas Zuberbuehler,

I don't think this is a bug, but rather a case of "The application works as designed", as Esri developers, or any developer for that matter, tend to say in cases like this. You cannot change this default value in this way, so the REST endpoint silently refuses to apply your change (without returning a message).

And it is even worse... I will explain. As you might have read:

As of the June 2018 update to ArcGIS Online, domains can be added and updated directly in ArcGIS Online through the Data tab in the hosted feature layer's item page.

And if you go to this Data tab on the item page, you will see that you can edit the List of Values (Domain), but you can only see - but not edit - the Default Value (see screen capture below).

I guess you have to set this default value during the design of the Feature Class (in ArcGIS Desktop?).

HTH,

Egge-Jan (a fellow Esri user)

Thomas_Z1
New Contributor III

Hi Egge-Jan,

Bedankt voor de snelle reactie. Thank you for your answer! I really wish ESRI would provide a better API and schema documentation... (not only for the ArcGIS REST API but also for arcpy)

Unfortunately I am not able to change the design of the feature class since they already started to collect data in the field. But I did find a workaround for my problem/use case: templates.

/* ... (pseudo JSON) */
"templates" : [{
  "name" : "Pipe", 
  "description" : "", 
  "drawingTool" : "esriFeatureEditToolPoint", 
  "prototype" : { 
    "attributes" : {
      "pipeId" : null, 
      "pipeType" : 2 /* <--- changed to 2 */
    }
  }
}]
/* ... */‍‍‍‍‍‍‍‍‍‍‍‍‍

Changing "pipeType" : null to "pipeType" : 2 pre-populates a default value when adding a feature using ArcGIS Online and the Collector App.

Hope this will help other users too.

Have a great evening,

Thomas

Further resources/reads: