1

The idea is to provide a way for specifying global labels.




Currently when you are creating an integration project in Business Central and need to read/write some values from a web service for example, you have several options:


hardcode the field identifiers as inline literal. This is fast and clean, but as soon as you need to use them in several places it becomes a mess.

use Labels/TextConst variables. This solves the issues with multiple usage, but only in the object itself. If for any reason you need to reuse these identifiers in several objects (the same part of data is used in multiple different requests handled in different codeunits for example) you have no choice but duplicating them, or create a procedure which returns the value of the label which bloats the code with unnecessary lines - four additional lines per label for such a procedure.



These could be examples of using such feature:



Example for label definition:

codeunit 50001 GlobalLabelsDefine1

[

  PublishGlobalLabels = true;


  var

    Label1: Label 'This is my label', Locked = true;

]


Another example for label definition:

codeunit 50002 GlobalLabelsDefine2

[

  var

    Label2: Label 'This is my second label', Locked = true, Global = true;

]


Usage example:

codeunit 50003 GlobalLabelsUsage

[

  var

    GLD1: Codeunit GlobalLabelsDefine1;

    GLD2: Codeunit GlobalLabelsDefine2;


  procedure UseLabels()

  begin

    Message(GLD1.Label1);

    Message(GLD2.Label2);

  end;

[



This feature will allow avoiding unnecessary duplication of labels, code bloating and debug headaches.

Category: Development
STATUS DETAILS
New