AGOL hosted feature layer:
For non-string fields like GUIDs and integers, we can set up default value expressions using the Admin REST API:
(The user-defined field name is unique_id.)
- GUID: "defaultValue" : "NEWID()"
Inserts a GUID value like 7ec3018d-4a49-4a13-8e15-005846b25848 - Integer: "defaultValue" : "IDENT_CURRENT('db_2xxxx.user_2xxxx.test_layer_TEST_LAYER')"
Inserts a copy of the Object ID.
But for string fields, everything we try to put into a string field just ends up writing the function name and parameters as a literal string, e.g. "CONCAT(v1, v2)". We are trying to insert a sequential integer ID with a text prefix, such as SEWER-0000001.
There seems to be a limitation where the system has no way to differentiate a literal string from an expression/function. Could expression functionality be added for string default values?
Related AGOL Question: https://community.esri.com/t5/arcgis-online-questions/add-guid-field-to-existing-agol-survey123-feat... @MobiusSnake
We're aware that IDs can be generated/inserted at the app level. But there are cases where it'd be preferrable to do it at the AGOL hosted feature layer level, so the IDs are inserted globally, regardless of where the edit is happening.