Labels suffixed with Tok must be locked (AC0020)

Labels ending with the suffix ‘Tok’ represent tokens: hardcoded, non-translatable values. Such labels must explicitly have the Locked property set to true to prevent translation.

The ‘Tok’ suffix is a widely-adopted naming convention in Business Central AL development to indicate that a label contains a technical identifier, API constant, or other value that should never be translated.

A code fix is available for this diagnostic.

Example

The following label is suffixed with ‘Tok’ but not locked:

codeunit 50100 MyCodeunit
{
    var
        ApiVersionTok: Label 'v1.0'; // Label 'ApiVersionTok' is suffixed with 'Tok' but does not have the Locked property set to true. [AC0020]
}

To fix this, add Locked = true:

codeunit 50100 MyCodeunit
{
    var
        ApiVersionTok: Label 'v1.0', Locked = true;
}

See also

  • AC0021 - Locked Label must have a suffix Tok
  • AC0027 - Use the ‘Tok’ suffix for token labels