When using templates to create AL objects for MicrosoftDynamics 365 Business Central, there are often many properties that are listed by default. If they are part of a template, then they must be important. So one question I had from new developers is what is a UsageCategory, and why should we be setting it.
Labels are string constants that can be translated into multiple languages. They can be used for things like captions, descriptions, questions, error messages, or other text constants. Labels have a specific syntax, which includes a text constant, followed by three optional parameters.
Parameter
Type
Description
Comment
Text
Used for general comments about the label, specifically giving details about the placeholders in the label.
Locked
Boolean
When Locked is set to true, the label shouldn’t be translated. The default value is false.
MaxLength
Integer
Determines how much of the label is used. If no maximum length is specified, the string can be any length.
My most recent project has large footers being added to the bottom of their reports to display Terms and Conditions. This is something fairly common that is requested, and I’ve always shied away from hard-coding anything inside the report layout. If an address changes, then they have to get a developer involved to change the text vs being able to modify it themselves on a setup page. You could use a blob field to store all of the Terms and Conditions, but then you had no way to format a giant block of text, until now. ✨Business Central version 23 now has the power of leveraging the built-in rich text editor, and we can display that formatted text on our reports (with a few gotchas).
I was working on a task where it was suggested to create an Option field so we had a shorter list of values available to users. When I got into the nitty gritty of development and was trying to set the value from an Enum I was getting a warning “An implicit conversion is being performed from a value of type ‘Enum xxx’ to a value of type ‘Option’. This conversion can lead to unexpected runtime issues. This warning will become an error in a future release.” I know there are ways to do conversions, but do I really need to use an option? Wouldn’t it be nice to just use the Enum?
I then stumbled across the ability to limit the (enum) values available to users. You can set this with the ValuesAllowed property on Tables or Pages. All you have to do is separate the values with a comma.