Skip To Content

Add a unique constraint to a field

You can apply a unique constraint to individual fields in sublayers in your hosted feature layer. When you apply a unique constraint, the relational data store ensures that there are no duplicate values stored in the field. You might do this for fields you intend to use to uniquely identify features in the layer. When editors update attributes or add features to your layer, the unique constraint ensures the editor does not add duplicate values. When you append or update data in the feature layer, if the file you use to append or update fields contains a value that would violate the unique constraint, the append or update operation will fail.

In most cases, unique constraints are applied to numeric fields, but you can set a unique constraint on any field type except system fields such as ObjectID, GlobalID, and FID.

The layer owner and the organization administrator can set unique constraints on fields in hosted feature layers.

Follow these steps to add a unique constraint to a field in a sublayer of your hosted feature layer:

  1. Open the details page for the hosted feature layer that contains the sublayer in which you will set a unique constraint.
  2. Click the Data tab.
  3. If the hosted feature layer contains more than one sublayer, choose the sublayer you want to configure from the Layer drop-down menu.
  4. Click the field name of the layer to which you will add a unique constraint and click Show Detailed View.
  5. Under Settings, click Edit in the Unique field.
  6. Check the Field contains unique values check box and click Save.

    ArcGIS Enterprise confirms that existing values in the field are unique. If they are, the unique constraint is added and the Unique value is updated to indicate the field has a unique constraint applied to it. If values are not unique, you cannot set a unique constraint on this field until you edit the field so it contains only unique values.

If you later decide to remove the unique constraint, edit the Unique field again, uncheck Field contains unique values, and click Save.