Error: Cannot find enum value in field ... of document model

Hi,

we are having a very simple model containing an enumeration field with 2 items. While using version 2022.02 everything worked fine, but after upgrading to 2022.06, we started to have a problem when opening the form model. When opening the form model (by creating a new document from the overview model), we get this error:

Error: Cannot find enum value in field /root/title of document model User.

The model looks like this in SME (8.2.2):
immagine

When opening the form model directly from the UI designer, the enumeration field is working correctly:
immagine

However, when trying to create a new document instance in the overview model of our actual react application, this error from above occurs with the following stacktrace:

Uncaught Error: Cannot find enum value  in field /root/title of document model User.
    localizeEnumerableFieldValue Defaults.ts:228
    formatValue Defaults.ts:175
    formatValue format.ts:28
    getValueByPath utility-functions.ts:142
    getValueForUI input-value.ts:44
    calculateFieldBasedInputOptions input-control.tsx:289

We use the following versions of A12 dependencies:

"@com.mgmtp.a12.base/base-model-api": "26.2.0",
"@com.mgmtp.a12.client/client-core": "12.3.0",
"@com.mgmtp.a12.dataservices/dataservices-access": "34.2.1",
"@com.mgmtp.a12.dataservices/dataservices-server-connector": "34.2.1",
"@com.mgmtp.a12.formengine/formengine-core": "34.7.0",
"@com.mgmtp.a12.kernel/kernel-core-runtime-api-ts": "27.3.1",
"@com.mgmtp.a12.kernel/kernel-md-facade": "27.3.1",
"@com.mgmtp.a12.overviewengine/overviewengine-core": "34.4.0",
"@com.mgmtp.a12.uaa/uaa-authentication-client": "5.2.2",
"@com.mgmtp.a12.utils/utils-connector": "5.3.1",
"@com.mgmtp.a12.utils/utils-localization": "5.3.1",
"@com.mgmtp.a12.utils/utils-localization-react": "5.3.1",
"@com.mgmtp.a12.utils/utils-logging": "5.3.1",
"@com.mgmtp.a12.widgets/widgets-core": "34.6.0",
"@com.mgmtp.a12.workflows/workflows-client": "8.0.6",

(the problem also happens with formengine-core 34.6.0, like it appears in the latest template 2022.06.ext4)

Hi,

your error message points to the issue that the value of that “title” field is an empty string.

This is not a valid value for enumeration fields.
Enumeration fields may only be assigned with any of their modeled enumeration values.
An empty enumeration field must be represented by null or undefined.

If you customized the document creation, you might want to take a look there.

Thanks for the answer!

It was actually the case that in our custom DataProvider we were setting the default value of the enumeration field to "", when a new document instance was being created, to represent that the field should be empty at the beginning. This was the reason for the dropdown to break. Replacing "" with undefined solved the problem for us.

Seems that "" is only disallowed since 2022.06…