Select to view content in your preferred language

Domains do not appear in Collector after updating in AGOL

1711
4
05-23-2018 07:16 AM
mingster
Occasional Contributor

I updated the coded value domain of a hosted feature service in ArcGIS Online, but the new values do not appear in the Collector app. I reloaded the map, but nothing changed. I added "NA" and "DNE", but only the original values "N" and "Y" appear as options in Collector. Is there a step that I missed?

Coded value domain

4 Replies
RandyBurton
MVP Alum

Is the field with the newly updated domain associated with the layer's symbology?  If so, you may also need to make an adjustment in the types section of the JSON file.

0 Kudos
mingster
Occasional Contributor

Yes, the domain is associated with the layer's symbology. Can you elaborate on what adjustments I need to do in the JSON file? Sorry, my coding experience is very beginner level. Thank you Randy.  

0 Kudos
RandyBurton
MVP Alum

The types section is near the bottom of the JSON file,  and it will look something like this:

  "types" : [
    {
      "id" : "N", 
      "name" : "No", 
      "domains" : 
      {
        "Status" : {"type" : "inherited"}, 
        "AnotherDomain" : {"type" : "inherited"}
      }, 
      "templates" : [
        {
          "name" : "No", 
          "description" : "", 
          "drawingTool" : "esriFeatureEditToolPoint", 
          "prototype" : {
            "attributes" : {
              "AnotherDomain" : null, 
              "NoDomain" : null, 
              "Status" : "N"
            }
          }
        }
      ]
    }, 
    {
      "id" : "Y", 
      "name" : "Yes", 
      "domains" : 
      {
        "Status" : {"type" : "inherited"}, 
        "AnotherDomain" : {"type" : "inherited"}
      }, 
      "templates" : [
        {
          "name" : "Yes", 
          "description" : "", 
          "drawingTool" : "esriFeatureEditToolPoint", 
          "prototype" : {
            "attributes" : {
              "AnotherDomain" : null, 
              "NoDomain" : null, 
              "Status" : "Y"
            }
          }
        }
      ]
    }, 
    {
      "id" : "NA", 
      "name" : "Inaccessible", 
      "domains" : 
      {
        "Status" : {"type" : "inherited"}, 
        "AnotherDomain" : {"type" : "inherited"}
      }, 
      "templates" : [
        {
          "name" : "Inaccessible", 
          "description" : "", 
          "drawingTool" : "esriFeatureEditToolPoint", 
          "prototype" : {
            "attributes" : {
              "AnotherDomain" : null, 
              "NoDomain" : null, 
              "Status" : "NA"
            }
          }
        }
      ]
    }, 
    {
      "id" : "DNE", 
      "name" : "Does not exist", 
      "domains" : 
      {
        "Status" : {"type" : "inherited"}, 
        "AnotherDomain" : {"type" : "inherited"}
      }, 
      "templates" : [
        {
          "name" : "Does not exist", 
          "description" : "", 
          "drawingTool" : "esriFeatureEditToolPoint", 
          "prototype" : {
            "attributes" : {
              "AnotherDomain" : null, 
              "NoDomain" : null, 
              "Status" : "DNE"
            }
          }
        }
      ]
    }
  ],

The id is the coded value for your domain.  The name is the description of the code.  Fields that use domains (for example the field "AnotherDomain") will be listed in the domains section; type: inherited means they should keep the value they have when the symbol is changed.   All editable fields should appear in the attributes section; a null value indicates the field's value should not change when the symbol is changed.  In this example, the "Status" field is using the "Status" domain, and its value will be changed to the coded value that matches its ID.  The "NoDomain" field represents the fields without domains.  If a field in the attributes list has a value other than null, its value will change when the symbol "Status" field is changed; this may be a desired action.

You can copy the section from the JSON file, add your new coded values to it (probably by duplicating the yes-no section and changing to the two new options).  Then remove the comma after the last square bracket, enclose the section in curly braces { }, check it with jsonlint.com for valid json format, and then you can update that section using the REST API.  It should be a similar process that you have used for updating the field.

NOTE: I recommend experimenting with a back-up copy until you are confident with the process.

mingster
Occasional Contributor

Awesome. I will give this a try. I appreciate your help. Thank you.

0 Kudos