Hello,
I am currently working with the newest version of Business Central.
I have created an enum, let's say Enum "Colours" with following values:
• Red,
• Violet,
• Yellow.
Afterwards, I want to create two tables with field "Colour" of type Enum "Colours".
In the first table I want to have all colours available, so the end-user could see: Red, Violet and Yellow as an option.
The second table I would like to have only two of these colours, so the end-user see: Red and Violet.
Is it posible to hide enum values for other fields?
or the only solution is to create two enums - one containing all of the options and the second one, containing only two of these colours?
0
Answers
For example:
thank You for your response. It works as intended.
But it's a little bit problematic, because let's say that after a while there is a new colour: Orange. So I am typing a new value to Enum Colours. So now I have to remember to go to each table, which uses this enum and add another allowed value, to those fields. Right?
I didn't find a way to define not allowed values, for specific field, that would be a little bit easier to maintain. Do You know a way to do that?
If you don't hide the value, you can control it in the OnValidate trigger. That might be simpler.
Since you have to add the value of Enum in VS Code every time, you can maintain this property by the way.
It may be simpler to refer to the following method.
Imagine using this particular enum for 500 different fields In that case you would have to analyze each field individually - either you want new value or not.
In my opinion it's easier to have few enums - maybe it's uglier solution, but I have to think in a little bit bigger perspective.
Thank you for your time though.