web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Change custom fields type from Option -> Enum

(0) ShareShare
ReportReport
Posted on by 21
Hi,
 
     I was wondering if Microsoft is changing standard Option fields into Enum, should we do it also?
 
In BC25 Could version we have this field:
 
 
This is clearly an old field that before was an option and now is an Enum. If I open the sales order, is still option as it was originally.
 
 
If I Check Fields table: 
 
OptionMembers = TableFilter,RecordID,OemText,Date,Time,DateFormula,Decimal,Media,MediaSet,Text,Code,Binary,BLOB,Boolean,Integer,OemCode,Option,BigInteger,Duration,GUID,DateTime;
There is No ENUM in this list.
 
For the breaking change Microsoft says:
This statement is a warning and is related to when you make a new field of type Enum and copy values from Option. As long as Option and Enum have same values, this warning should be no problem. Also, I tried, and changing custom fields from Option to Enum is nor an error or warning for AppSourceCope, also deploying change into Cloud environment the existing values in Option field are not lost.
 
Still I have this Question:  Is it a breaking change if I Replace Option type of field with Enum directly, NOT to create a new Enum field and copy values from Option, that Microsoft says in the above link is a warning.
 
 
 
I have the same question (0)
  • Suggested answer
    Bilal Haider Profile Picture
    414 on at
    Hi,
     
    Interesting post! I never noticed that in page inspection the document type shown is still option although in table definition its an enum. 
     
    If you are replacing option type with enum then it is actually recommended by Microsoft. Also using enums make our lives easy as then we need to maintain only at one place. like if a new value is added, or value is being updated.
  • Suggested answer
    Kamal Khakhkhar Profile Picture
    1,282 on at
    Hii there,
    As per requirement you can update data type from option to enum it's not make any error. You need to add all the options members to enum and then update the some of code as per enum . It will work. Even though you are worried about your data create new field . Move data to that field and obsolete the old field.
     
    Thank you.
    Kamal Khakhkhar
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,601 Super User 2025 Season 2 on at
    Replacing an Option with an Enum is safe if you preserve the same ordinal values (order and numbering) of the original Option members. 
  • Gerardo Rentería García Profile Picture
    25,236 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints. It's time to Enumify your Option fields in AL and Business Central

     

  • Suggested answer
    Inkey Solutions Profile Picture
    2,100 on at
    Hello, 

    If the field data type is either Enum or Option, it will always appear as an Option in the table field of Business Central.

     
    When replacing an option field with an enum field, the ordinal values must match those of the original option members. Changing these values can cause data inconsistencies and corruption during upgrades. Additionally, extensions relying on specific ordinal values may fail if altered in the enum field.

    To resolve this error, follow these steps:
    1. Locate the enum field in your code that is replacing an option field.
    2. Ensure that the ordinal values of the enum members match those of the original option members.
    3. If the ordinal values don't match, adjust the enum members to preserve the original ordinal values.
    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans