Attribute Inspector / Feature layer with not-null constraints

Discussion created by harrygibson on Apr 18, 2012
Latest reply on Apr 20, 2012 by harrygibson
As the title says, I have a feature layer, which is based on a feature class where several fields are constrained to be NOT NULL. I'm hoping to use this to provide the back-end to a volunteered geographic information type map. Likewise I am hoping to use the template picker and attribute inspector to create the features.

The default workflow in the samples is for the feature to be created using applyEdits with the clicked geometry and null attributes when the map click or draw end event fires, then to display the attribute inspector on this feature to update them. But as far as I can tell I can't take this approach as I can't create the feature with null attributes due to the feature class constraints.

The workflow that seems to be sensible is for a map onclick event to create a new feature as a graphic, and then display the attribute inspector on it in an infowindow, with a submit button. When the fields are populated (and validated), pressing the submit button will be what calls applyEdits on the feature layer, which can now be done as all attributes are present.

This is pretty much what seems to be done by the Citizen Request Sample template app which "rolls its own" content for the info window to populate the fields. But i'd rather use the template picker and the attribute inspector to do the attribute editing, particularly because of the ease of styling, working with coded value domains etc, and so that the app isn't totally tied to the schema of the feature class like it is with that template.

But the attribute inspector seems to be inherently tied to feature layers rather than graphics.

What am i missing? Any suggestions as to a better way to accomplish this? The main point is that I don't want to get features submitted that don't have all the attributes I need, hence the use of the constraints when I set up the feature class.

Thanks! Harry