I have taken advantage of the newly added capability of setting a unique constraint on a field in a hosted feature layer. I am seeing some odd behavior around that functionality. Here's how to reproduce the behavior
- Create a new hosted feature layer in AGOL
- Add a text field, lets call it 'testid'
- Set a unique constraint on testid
- Add the hosted feature layer to a new map
- Use the Map Viewer Edit tool to create a new feature and do not enter a value for 'testid'. Save that feature
- Now try to create another new feature
The system wont let me create a new feature. Instead, after clicking the place on the map where i want to add the new feature, no new feature is added and a popup window is displayed with the values from another feature in the hosted feature layer. If i go back to feature with the missing value for testid and populate the field with a unique value, all goes back to working as expected.
I suspect it's happening because behind the scenes a new feature is created with 'null' or empty (or default if set) values for each attribute. And when the system sees a duplicated value, i.e. null/empty value for the field testid, the system can't handle that?
Anyone else see this behavior? Is this the expected behavior?