English

Problem: Unable to modify the nullable property of a hosted feature service from the REST endpoint

Description

In some instances, when attempting to use the Update Definition operation to change the "nullable" property of a field in a hosted feature service, the changes appear to be successful but then revert back to the original value.   For example, after changing the nullable property of a field from a value of true to a value of false and then clicking Update Layer Definition, a successful message of "Updated Feature Service Layer" is returned. However after checking the service definition, the changes made to the field are not applied to the hosted feature service and the original value remains.

This is the same for any feature class in ArcMap when trying to alter the Nullable property of a field. When attempting to change one of the fields of feature class that has already been created, from nullable: true to nullable: false, the following error is returned:

Error:   
Alter Field Nullable Failed: Unable to alter the field's Nullable property.
The table or feature class is not empty.

Cause

This issue occurs because there may already be null values present in the field for existing features. It is not recommended to edit the nullable property once the feature class or the hosted feature service has been created. Editing may cause issues with the data or an error may be returned.

Solution or Workaround

Republish or overwrite the hosted feature service after making changes to the Nullable property of a field from ArcGIS for Desktop or ArcGIS Pro.

Note: 
The only way to create a non-nullable field is to specify the property when creating the feature class (or when creating a new field in an existing feature class).

Related Information

Blog: Updating Hosted Feature Services in ArcGIS Online
Blog: How to Update Your Hosted Feature Service Schemas in ArcGIS Online
Error: Unable to update feature service layer definition. Invalid definition for 'lastEditDate'