<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create List (Domain) again after previously deleted it. in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/create-list-domain-again-after-previously-deleted/m-p/1019647#M38159</link>
    <description>&lt;P&gt;I've definitely had this happen, too. Perhaps someone else has an alternate method, but the only way I could re-apply a list was to use Python to directly edit the service properties, as described in the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerManager" target="_self"&gt;Feature Layer Manager section of the python API docs&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;A big caveat: direct modifications to the service JSON can be risky. The service won't always &lt;EM&gt;let&lt;/EM&gt; you make modifications if your input isn't formatted correctly, but it's quite possible to apply edits to the wrong layer, field, etc.&lt;/P&gt;&lt;P&gt;Also: to help you format your update, refer to the JavaScript docs for the Update Definition command, &lt;A href="https://developers.arcgis.com/rest/services-reference/update-definition-feature-layer-.htm#ESRI_SECTION2_3A549061A5E54E9A85A180E823202024" target="_self"&gt;especially example 6&lt;/A&gt;, in which a field domain is edited.&lt;/P&gt;&lt;P&gt;Your code might look something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features.managers import FeatureLayerManager

gis = GIS('your-portal-url', 'your-username')

flm = FeatureLayerManager.fromitem(gis.content.get('your-layer-itemID'), your-layer-index)

update_json = {
  "fields": [
    {
      "name": "your-field",
      "domain": {
        "type": "codedValue",
        "name": "domain-name",
        "codedValues": [
          {
            "name": "Coded Value 1",
            "code": "Code_1"
          },
          ...
          }
        ]
      },
      "defaultValue": null
    }
  ]
}

flm.update_definition(update_json)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you prefer using the Portal's interface for modifying your list, it should be possible to use this to establish the existence of the list with only a single value, then go into the &lt;STRONG&gt;Field&lt;/STRONG&gt; view in your Portal to add other codes to it.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2021 15:06:14 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-01-25T15:06:14Z</dc:date>
    <item>
      <title>Create List (Domain) again after previously deleted it.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/create-list-domain-again-after-previously-deleted/m-p/1019521#M38149</link>
      <description>&lt;P&gt;I've previously created domain in ArcGIS Online by clicking the 'create list'. But then I deleted the list because I decided not to apply domain to the attribute list. Now I want to apply the domain back. However, the 'create list' button is no longer there. How to create list again after previously deleted it?&lt;/P&gt;&lt;P&gt;Attached together is the screenshot&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 03:35:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/create-list-domain-again-after-previously-deleted/m-p/1019521#M38149</guid>
      <dc:creator>frhilyana_geo11</dc:creator>
      <dc:date>2021-01-25T03:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create List (Domain) again after previously deleted it.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/create-list-domain-again-after-previously-deleted/m-p/1019647#M38159</link>
      <description>&lt;P&gt;I've definitely had this happen, too. Perhaps someone else has an alternate method, but the only way I could re-apply a list was to use Python to directly edit the service properties, as described in the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerManager" target="_self"&gt;Feature Layer Manager section of the python API docs&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;A big caveat: direct modifications to the service JSON can be risky. The service won't always &lt;EM&gt;let&lt;/EM&gt; you make modifications if your input isn't formatted correctly, but it's quite possible to apply edits to the wrong layer, field, etc.&lt;/P&gt;&lt;P&gt;Also: to help you format your update, refer to the JavaScript docs for the Update Definition command, &lt;A href="https://developers.arcgis.com/rest/services-reference/update-definition-feature-layer-.htm#ESRI_SECTION2_3A549061A5E54E9A85A180E823202024" target="_self"&gt;especially example 6&lt;/A&gt;, in which a field domain is edited.&lt;/P&gt;&lt;P&gt;Your code might look something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features.managers import FeatureLayerManager

gis = GIS('your-portal-url', 'your-username')

flm = FeatureLayerManager.fromitem(gis.content.get('your-layer-itemID'), your-layer-index)

update_json = {
  "fields": [
    {
      "name": "your-field",
      "domain": {
        "type": "codedValue",
        "name": "domain-name",
        "codedValues": [
          {
            "name": "Coded Value 1",
            "code": "Code_1"
          },
          ...
          }
        ]
      },
      "defaultValue": null
    }
  ]
}

flm.update_definition(update_json)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you prefer using the Portal's interface for modifying your list, it should be possible to use this to establish the existence of the list with only a single value, then go into the &lt;STRONG&gt;Field&lt;/STRONG&gt; view in your Portal to add other codes to it.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 15:06:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/create-list-domain-again-after-previously-deleted/m-p/1019647#M38159</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-01-25T15:06:14Z</dc:date>
    </item>
  </channel>
</rss>

