Attribute rule dictionary keywords

Dictionary keywords expose advanced behavior of attribute rule functionality, such as returning custom error messages in conditional statements or performing edits to features in another feature class. When authoring ArcGIS Arcade expressions for attribute rules, the return dictionary type must use one of the reserved keywords listed below. To perform multiple operations, extend the dictionary with different keywords. To learn more about how to use these dictionary keywords, see Attribute rule script expression examples.

Note:

When defining globalD or globalIDs keyword parameters, ensure the value is enclosed in single quotation marks.

result

Provides a valid return value. You can use the result keyword to return a value and another dictionary keyword.

return {
    'result': 200
}

errorMessage

Specifies a user-defined error message for a failure during evaluation. Use the errorMessage keyword when creating logical statements in Arcade expressions to return custom error messages. This keyword cannot be returned in a dictionary with another keyword. See an example of how to return a custom error message.

return {
    "errorMessage": "Error message text"
}

calculationRequired

Marks other features as requiring evaluation of batch calculation rules. When this keyword is used, the corresponding feature or features are marked as requiring calculation by modifying the Validation Status attribute. This keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to mark other features as requiring evaluation.

Keyword parameterDescription

className

(required) The name of the feature class or table to modify. The value is the feature class name.

objectIDs | globalIDs

(required) An array of ObjectIDs or GlobalIDs to modify. The value is an array of ObjectIDs or GlobalIDs.

return {
    'calculationRequired': [{
        'classname': 'featureclass_name',
        'globalIDs': ['{8B421724-32D0-408A-A8EE-CCC2B064D52B}']
    }]
}

validationRequired

Marks other features as requiring evaluation of validation rules. When this keyword is used, the corresponding features are marked as requiring validation by modifying the Validation Status attribute. This keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to mark other features as requiring evaluation.

Keyword parameterDescription

className

(required) The name of the feature class or table to modify. The value is the feature class name.

objectIDs | globalIDs

(required) An array of ObjectIDs or GlobalIDs to modify. The value is an array of ObjectIDs or GlobalIDs.

return {
    'validationRequired': [{
        'classname': 'featureclass_name',
        'globalIDs': ['{60905A3D-9783-435D-B4C9-AA4ADA59AD32}']
    }]
}

edit

Performs inserting, updating, and deleting features in specified feature classes. This keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to edit another feature class.

For a utility network, the edit keyword can be used to edit associations using the associationType keyword inside the edit dictionary.

Keyword parameterDescription

className

(required) The name of the feature class or table to modify. The value is the feature class name.

adds | updates | deletes

The type of edit to make. The value is an array of dictionaries detailing the edits for each edit type.

Note:

Do not create a script that performs recursive edits. If a script is configured to perform an edit that triggers or evaluates the attribute rule, an infinite loop is created. This will cause unintended results.

adds

Keyword to use in the edit dictionary to perform inserts to a specified feature class or table.

Keyword parameterDescription

attributes

Edits specified fields. The value is a dictionary of field name and attribute pairs.

geometry

Edits the geometry. The value is a Geometry object.

associationType

Makes association edits in a utility network. Possible values include the following:

  • connected
  • container
  • content
  • structure
  • attached

The following are additional possible values for utility network version 4 and later:

  • junctionEdgeFrom
  • junctionEdgeTo
  • midspan

fromTerminal

The from terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name.

toTerminal

The to terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name.

isContentVisible

Specifies whether the content is visible for a containment association. The value is true or false.

percentAlong

The percent along a line or edge when editing a midspan associationType. The value is a percentage ranging from 0 to 1.

return {
    'edit': [{
        'className': 'b_edit_dict',
        'adds': [{
            'attributes': {
                'field_name': 11
            },
            'geometry': Geometry({
                'x': -76.8375008,
                'y': 39.4949383,
                'spatialReference': {
                    'wkid': 4326
                }
            })
        }]
    }]
}
"edit": [{
    "className": "ElectricDistributionJunctionObject",
    "adds": [{
        "percentAlong": 0.5,
        "associationType": 'midspan'
    }]
}]
}
return {
    "edit": [{
        "className": "ElectricDistributionJunctionObject",
        "adds": [{

            "attributes": {
                "assetgroup": 3,
                "assettype": 1
            },
            "toTerminal": "Load",
            "associationType": "junctionEdgeFrom"
        }]
    }]
}

updates

Keyword to use in the edit dictionary to perform updates to a specified feature class or table.

Keyword parameterDescription

objectID | globalID

(required) The ObjectID or GlobalID value of a feature to edit. The value is an ObjectID or GlobalID.

attributes

Edits specified fields. The value is a dictionary of field name and attribute pairs.

geometry

Edits the geometry. The value is a Geometry object.

associationType

Makes association edits in a utility network. Possible values include the following:

  • connected
  • container
  • content
  • structure
  • attached

The following are additional possible values for utility network version 4 and later:

  • junctionEdgeFrom
  • junctionEdgeTo
  • midspan

fromTerminal

The from terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name.

toTerminal

The to terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name.

isContentVisible

Specifies whether the content is visible for a containment association. The value is true or false.

percentAlong

The percent along the line or edge when editing a midspan associationType. The value is a percentage ranging from 0 to 1.

return {
    'edit': [{
        'className': 'b_edit_dict',
        'updates': [{
            'globalID': '{7EBAB596-E9DB-40D8-9756-B2EBED2500B7}',
            'attributes': {
                'field_name': 22
            }
        }]
    }]
}
return {
    "result": $feature.assetid,
    "edit": [{
        "className": "electricdistributionassembly",
        "updates": [{
            "objectID": feature_objectid,
            "associationType": 'container'
        }]
    }]
}

deletes

Keyword to use in the edit dictionary to delete specified features in a feature class or table.

Keyword parameterDescription

objectID | globalID

(required) The ObjectID or GlobalID value of a feature to edit. The value is an ObjectID or GlobalID.

return {
    'edit': [{
        'className': 'b_edit_dict',
          'deletes': [{
            'objectID': 22
        }]
    }]
}