With the Microsoft Dynamics 365 Business Central 2019 wave 2 release, Microsoft made available a new data type – Enumeration (Enum) in Business Central.
An enumeration type, also known as an enum in programming, Enum is a list that consists of a set of named constants. It can be used as table fields, local and global variables, and parameters.
Enum was introduced earlier but from new version i.e. Business Central 2020 wave 1 release onwards most of the option fields are available as extensible enum. Enum replaces the old Option data type and from now on, during development, instead of creating a new Option field we must create a new Enum.
Enums are more readable, reusable, and extendable compared to the Options data type
- Declaration of an enum
To declare an enum in AL you must specify an ID and a name. Enums are pure metadata and can’t contain any kind of code.
- Enum extension object
Enums can be extended in order to add more values to the enumeration list in which case the Extensible property must be set to true.
For example: We need to extend or adding one more value in “Service Item Status” enum.
After extending enum, Publish the extension files.