Dynamics 365 Business Central: What is TextConst Data Type???

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about what is TextConst Data Type in Business Central.
I’ve been asked this question before, in fact, this data type is rarely used in BC anymore, but that doesn’t mean it doesn’t work. Let’s take a look at MS Docs first.

TextConst Data Type: Denotes a multi-language string constant.

The TextConst data type is typically used for UI messages; process or error messages. Keeping the TextConst data type in global scope, makes it easier to reuse the same message for several situations.

So, the TextConst data type is text constant.

Next let’s look at some examples.

1. It can be declared as a variable just like Text Data Type, but it is not editable in the page and code.

2. Similar to CaptionML Property, we can set the string that displays in user interface for the current language.
TextConst Data Type has the following format.
<Language ID>='<caption>’

<Language ID> is the standard Windows three-letter language ID, and <caption> is the caption text for this language.

For example,

Use commas to separate entries.

In Danish (Denmark):

In Japanese (Japan):

At this time, you may find that this looks a bit similar to the Label Data Type. What is the essential difference between them?

The TextConst data type is not included in the .xlf files for translation. Make sure to use the Label Data Type instead.

For example,

Only Label Data Type (‘My text’) is included in the .xlf files.

So, the TextConst data type is actually the same as the locked Label data type.

LockedWhen Locked is set to true, the label should not be translated. Default value is false.

1. To submit an app to AppSource, you must use .xliff translation files. For more information, see Working with Translation Files and XLIFF translation files.

2. The multilanguage syntax is being deprecated. Please update to the new syntax. AL0424

For both 1 and 2 reasons, TextConst Data Type and CaptionML Property are basically no longer recommended.

3. TextConst and Label variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage. More details: CodeCop Warning AA0074

Three-letter suffixMeaning
QstStrMenu or Confirm
LblLabel, Caption


// TextConst suffixed with Tok for Token
MethodGetTok : TextConst ENU = 'GET';


Hope this will help.

Thanks for reading.



Copied title and URL