Attribute Rule Constraint

Since version: 1.5

With the Attribute Rule Constraint profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for constraint attribute rules in ArcGIS Pro. The script should return a Boolean with true indicating the feature meets the constraint criteria or false indicating it does not meet the criteria. You can also return a custom error message by returning a Dictionary of errorMessage.


The following products implement this profile:

Spatial reference

The spatial reference of the layer from which $feature originates determines the spatial reference of the expression's execution context.

Profile variables

Variable NameTypeDescriptionSince version
$datastoreFeatureSetCollectionA collection of layers in the same feature service or database as the $feature executing the script.1.5
$editcontext.editTypeTextIndicates whether the edit event is INSERT, UPDATE, DELETE, or NA (not applicable).1.10
$featureFeatureThe feature being evaluated for the constraint.1.5
$originalFeatureFeatureThe previous state of the feature being evaluated.1.9
$featureSetFeatureSetA collection of features in the same table as the $feature evaluating the expression.1.13

Function bundles

Core | Geometry | Data Access

Return types

Boolean | Dictionary

For a list of valid dictionary keywords, click here.


The following expression demonstrates how to prevent a feature from being deleted unless the feature is retired.

Use dark colors for code blocksCopy
if ($feature.lifecyclestatus == 128 || $feature.lifecyclestatus == 64)
  return true;
return {'errorMessage': 'You are not allowed delete a feature until it is retired'};

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.