Setting required fields for a feature service in ArcGIS Online

25768
30
06-04-2014 08:37 AM
JoshWhite
Regular Contributor III
I am testing out a feature service for use in web editing, primarily through Collector.  I am testing in ArcGIS Online.  I tried to edit an existing feature and there are a couple of fields that have a yellow triangle and with an exclamation point next to them and a popup that states that this value is required.  I cannot seem to figure out how this property is set.  The two fields in one particular feature that are marked as required aren't really required and other fields that should be required are not required.  How do I change the property of this?  In the feature class it seems the only thing you could change is whether or not a field is nullable but that doesn't appear to affect anything else.  The template doesn't have an option for requiring fields either.  ArcGIS Online nor Collector have any options that I can find to alter this either.  The service properties don't reference required fields either.
Tags (2)
30 Replies
ANRGIS
by
Occasional Contributor
TonyViveiros1
Occasional Contributor

I've been trying to use the new Smart Editor widget to edit certain fields of a feature service,however, it's preventing me from saving these edits because, as far as I can tell, a 'required' field in the service must also be edited.  As Josh White inquired in his original post, I'm also unclear how this field got flagged as being required (see image). More importantly, how can I remove this field requirement?  Re-publishing the service is not an option as field crews are actively editing the data using Collector.  I've tried editing the feature service URL by changing the field property from  "nullable" : true to "nullable: false; however, this is not persisting after I update the layer definition. Any ideas on how to get rid of this feature service field requirement would be appreciated.

AGOL_RequiredField.JPG 

TonyViveiros1
Occasional Contributor

I meant to say I've tried editing the feature service URL by changing the field property from  "nullable" : false to "nullable: true...

0 Kudos
ZackBradford
New Contributor

When I change 'Allow NULL Values' in Feature Class Properties on ArcMap Desktop from 'Yes' to 'No', it doesn't make the field required in my Geoform. It prevents the question from showing up in the form at all! Anyone else having this issue and know how to resolve?

I'd like to make questions required in my Geoform, but it seems the only question that can be required is the one used with symbology.

Thanks!

0 Kudos
GodwinBadu-Marfo
New Contributor II

I don't know how far this question has gone but when I set required fields in collector 10.4.2, the warnings show but empty required fields are allowed to save without any prompt. Please is there any workaround to fix this? 

ZorbaConlen1
Occasional Contributor III

Similar issue for me. Not using collector, but the webmap allows creation of features, with null values for required fields. I am seeing the yellow triangle indicator, but I would expect the 'close' (save) button to be disabled until all req fields are populated. 

Thanks

0 Kudos
KellyGerrow
Esri Frequent Contributor

How did you set the required filed? By not allowing null values?

0 Kudos
ZorbaConlen1
Occasional Contributor III

Yes, exactly. Is there another way to do it?

Thanks

0 Kudos
RonnieRichards
Regular Contributor

I have had this complaint for a while only to be told by ESRI Support this is the way the geodatabase works and based on my research is related to shapefile exports. Only some of the ArcGIS applications (Ie: Collector) will support the NON NULLABLE field property, while their flagship products (ArcMap, ArcGIS Pro, Web Maps) ignore it and post space values (in the case of string fields). Even the latest version of ArcGIS Pro when editing a local file geodatabase will "work around" the data model and not respect the NON NULL or REQUIRED FIELD settings. It seems rather pointless to have these tools around for fields if the platform is inconsistent with the way the are validated (or not).

I submitted this idea several months ago but it probably needs a better description after reading it again. 

Fix Feature Services so they do not bypass the data model 

Also here is a section from ArcGIS Help which states how these field properties will be dealt with when exporting to shapefiles but this seems to be the default behavior of most of the applications when editing a file, sde gdb or feature service with field properties set for NON NULLABLE or REQUIRED.

Defining feature class properties—ArcGIS Help | ArcGIS Desktop 

Geoprocessing considerations for shapefile output—Help | ArcGIS Desktop 

I really wish the tools (especially web maps) would not create a record if the user does not interact, complete the required or non-null fields or hit "x" on the form it just ends up creating a lot of garbage data. The web map actually creates the record before the popup comes up kinda of a bad design and does not have to be this way. Geometry can be stored in a memory along with the form attributes. Can you imagine if our bank transfers still went thru if we hit the "X" to close the window? Results in a confusing user experience and bad data the administrator has to clean up later. 

0 Kudos
KellyGerrow
Esri Frequent Contributor

Thanks Ronnie,

 

You have described what causes this issue well. The issue is that when publishing a default value of 0 or null is added, which is automatically added when editing in Javascript Applications. It was built this way to support the workflows in the past, but now results in an unideal user experience. There is a way to workaround this with ArcGIS Online Feature Services. When publishing a default value is added to the editing template. This default value can be changed to null through the feature Services admin API, which will result in records without required fields being rejected.

 

You can see this behaviour with the following web map where i modified the template for the field RatsFound to have a default of null:

http://arcg.is/1fL99W 

 

https://services5.arcgis.com/cuQhNeNcUrgLmYGD/ArcGIS/rest/services/Rat_Tracker/FeatureServer/0?f=pjs... 

 

To change this you will need to access the feature service admin api, and modify the template to include null the correct template value.

In this example, I changed the template from example A To example B in the updatedefinition call of the feature service admin:

Example A: Space for default value

{
"templates": [

                       {  

                      "name": "Rats",

                      "description": "",

                        "drawingTool": "esriFeatureEditToolPolygon",

                        "prototype": {

                                    "attributes": {

                                               "Inspection": null,

                                               "DogBreed": null,

                                                "RatsFound": ""
                                                              }
                                                      }
                                    }
                               ]
}

Example B: null for default value

{
"templates": [

                       {  

                      "name": "Rats",

                      "description": "",

                        "drawingTool": "esriFeatureEditToolPolygon",

                        "prototype": {

                                    "attributes": {

                                               "Inspection": null,

                                               "DogBreed": null,

                                                "RatsFound": null
                                                              }
                                                      }
                                    }
                               ]
}

0 Kudos