Cerca
  • marco ferrari

ENUM vs Options

In the latest version of Business Central you can see that the Option data type fields have been converted into ENUM.

Let's see the Sales Header table:

Let's take a view to the Enum "Sales Document Type":

Compared with the past, we can note that the original sequence of the OptionMembers has been converted into the ENUM.

This is true also for those options that have been modified in a localization process. We can make a comparison between the "Gen. Journal Document Type" of the W1 version

The Gen. Journal Document Type of the W1 version

and the same ENUM of the Italian version:

In this case to the "Dishonored" string has been associated the value 10, not 7 as we could expect. This is exactly the same value it had in the OptionMembers property:

This is due to a compatibility problem with the former versions. As you probably know, the Option fields were simply integer into the SQL table, and the same is true for the ENUM data type, so they could not change the value without creating many problems (better to say a disaster) in the update process.

For this reason, if you customized an option field by adding some values at the end, now you have to use the "enum extension" object to add your value

Going forward, if you want to add new values into a standard ENUM, never use the next value available, but use the same numbering you have for the customization/app, so you are sure that no one (standard or localization process) will use the same.




#enum #options #upgrade

73 visualizzazioni

©2020 di Marco Ferrari