D365FOE. Issue with enums that have “Use Enum Value” property set to “No”.

Recently we have noticed incorrect behavior of enums that have “Use Enum Value” set to “No” and have gaps in enum values. These enums use values from properties when populated from user interface, however, X++ code uses generated values, that cause inconsistent behavior and data corruption.

To illustrate this issue, we will create new enum with two values: 0 and 10. Also we need to set “Use Enum Value” property to “No”.







Also, we need simple table that has only one field, form to populate this field from UI and job to create data from X++.





Runnable class:


Let’s run the class and check data in DB and UI.

In DB value is equal to value from enum properties – 10:


On the form we can see empty value:


Let’s create new record using UI and check what is saved to DB.



As you can see, value is equal to 1. For these enums value entered from UI will never be equal to value entered from X++ code, so if it is created in X++ user would see empty values, if it is created from UI X++ comparison like:

If (myTable.MyEnum == MyEnum::Ten)  

would always return false, even if user see “Ten” on UI, because values are different.

It was a common practice to have gaps in enum values for different layers, so you could avoid conflicts when new values are created in new version or a hotfix. AssetTransType is a good example, where localization related values start from 100, because they used to be on another layer.

However, most of standard enums use enum values, so probably that is why this bug was not spotted before.

As a good citizen, I filled a bug, but I have a sneaky suspicion that it won’t be fixed soon, so be aware of this volatile mix, try to avoid changing “Use Enum Value” property and review your enums in case you have one!

11 thoughts on “D365FOE. Issue with enums that have “Use Enum Value” property set to “No”.

  1. Mike Joachim October 18, 2017 / 2:01 am

    Thanks ievgen.

  2. Jovan Kirkov June 13, 2018 / 11:20 am

    I have struggled with this issue few times, and noticed the data corruption on db level. Any viable solution besides using the label of the enum element for comparison?
    str selectedValue = formComboBoxControl.getText(formComboBoxControl.selection());
    if (selectedValue == “@MyLabel”)

    • Ievgen Miroshnikov June 13, 2018 / 8:58 pm

      I logged a bug and MS closed it as fixed but I never checked it to be honest. What version are you using ?

      • Jovan Kirkov June 14, 2018 / 7:55 am

        I’m using 8.0 version. But upon further investigation the bug seems to be caused by standard code which is looping through the enum elements one by one, and removing some of them from the combo box. This causes discrepancies in the numbering, and saves corrupted data in the DB.

  3. Ievgen Miroshnikov June 14, 2018 / 8:12 am

    Could you please log it as a bug and give me repro steps so I can follow up with MS on the original bug ?

  4. Oswaldo August 24, 2018 / 4:06 pm


    I have a similar issue with the enums, when I try to import a data package. The system shows “Invalid Enum Value”, but the property of the enum is UseEnumValue = No

    Have you resolved your issue?

    I apreciate your support.

      • Oswaldo August 27, 2018 / 1:16 pm

        Thanks for your response.
        Yes, it is a standard entity.

  5. Mahesh October 28, 2018 / 8:53 am

    I am just wondering what’s the best way then to map integer enum values to its corresponding ENUM description.

    I am exporting few data entities to BYOD, and exported data contains integer values for Enums. However, I need to find out its corresponding description.

    • Ievgen Miroshnikov October 28, 2018 / 8:11 pm

      Hi Mahesh, that’s a good question and I don’t have an answer yet. In previous version you had SRSANALYSISENUMS table. It could be my next blog topic if I’ll find nice solution, stay tuned.

Leave a Reply to Ievgen Miroshnikov Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s