Select to view content in your preferred language

Reuse domain on different fields - AGOL

405
0
06-02-2023 09:28 AM
mikaël
Frequent Contributor

Since ArcGIS OnLine doesn't allow for boolean fields, I'm creating a domain that will contain "Yes" or "No" (to be used in a form within Field Maps).

Is there any way to create one domain on AGOL and then reuse it (possibly by calling its name)?

 

// first declare a domain
"fields": [
        {
          "name": "field",
          "type": "esriFieldTypeString",
          "alias": "field",
          "sqlType": "sqlTypeOther",
          "length": 3,
          "nullable": true,
          "editable": true,
          "domain": {
                "type": "codedValue",
                "name": "DomField",
                "mergePolicy": "esriMPTDefaultValue",
                "splitPolicy": "esriSPTDefaultValue",
                "codedValues": [
                    {"name": "Yes", "code": 1},
                    {"name": "No", "code": 0}
                ]               
            },
          "defaultValue": null
        }
]

// then reuse field when adding or updating layer definition and the field would inherit the domain values "Yes" and "No" and codes
"fields": [
        {
          "name": "field2",
          "domain": {
                "name": "DomField"
            }
        }
]

 

 

0 Kudos
0 Replies