How do I add a subtype or domain to an existing field in an existing Feature within Collector? Downloading and manipulating an FGDB doesn't help.

1207
4
Jump to solution
04-05-2017 02:40 PM
JackieFisher
New Contributor III

Using Collector to collect / update signs along multiple canals.  Want to consolidate the condition of each sign (good / weathered / repair / replace ect).  Any ideas how to make this happen?

0 Kudos
1 Solution

Accepted Solutions
RandyBurton
MVP Alum

You can use the REST API to edit the feature's json file.  Domains are listed in the fields section, and looks something like (in the case of a field named "Informed"):

    {
      "name" : "Informed", 
      "type" : "esriFieldTypeString", 
      "alias" : "2 Employees informed of laws", 
      "sqlType" : "sqlTypeOther", 
      "length" : 1, 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "YN", 
        "codedValues" : [
          {
            "name" : "?", 
            "code" : "?"
          }, 
          {
            "name" : "No", 
            "code" : "N"
          }, 
          {
            "name" : "Yes", 
            "code" : "Y"
          }
        ]
      }, 
      "defaultValue" : null
    }, 

If you decide to edit the json, I would also suggest looking at the "types" section in case the field needing modification is used in symbology.  This section may also require editing.

To get to the json file, in My Content, click on the feature layer.  From the layer's Overview tab, look in the Layers section and click on "Service URL".  You should get a page with a link indicating "JSON".  To update the json you need to be in the Administration directory.  Use the API Reference link for additional help.

If you haven't edited a json file, do some testing with a backup.

View solution in original post

0 Kudos
4 Replies
RickeyFight
MVP Regular Contributor
0 Kudos
JackieFisher
New Contributor III

AGOL

RandyBurton
MVP Alum

You can use the REST API to edit the feature's json file.  Domains are listed in the fields section, and looks something like (in the case of a field named "Informed"):

    {
      "name" : "Informed", 
      "type" : "esriFieldTypeString", 
      "alias" : "2 Employees informed of laws", 
      "sqlType" : "sqlTypeOther", 
      "length" : 1, 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "YN", 
        "codedValues" : [
          {
            "name" : "?", 
            "code" : "?"
          }, 
          {
            "name" : "No", 
            "code" : "N"
          }, 
          {
            "name" : "Yes", 
            "code" : "Y"
          }
        ]
      }, 
      "defaultValue" : null
    }, 

If you decide to edit the json, I would also suggest looking at the "types" section in case the field needing modification is used in symbology.  This section may also require editing.

To get to the json file, in My Content, click on the feature layer.  From the layer's Overview tab, look in the Layers section and click on "Service URL".  You should get a page with a link indicating "JSON".  To update the json you need to be in the Administration directory.  Use the API Reference link for additional help.

If you haven't edited a json file, do some testing with a backup.

0 Kudos
JackieFisher
New Contributor III

Thanks.  Will take a look at that.

0 Kudos