Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Description

Excerpt

You want to modify a label template by adding data to it

...

  • Gross Weight
  • Warehouse Class Code


Watch the video

Cloud Print: How to modify label-template and add data

Dataset

Item Labels are always based on an Item or an Item Reference as the source.

We will look up and add the values to the Print Dataset from this source.

Template design

The Standard Label Template Designs has "ExtraInfo"-fields that can display additional information from the Dataset.

We will use these existing fields as creating new custom fields would require changes to not only the dataset, but also the label template design.


Visual example

Note how "Gross Weight" and "Warehouse Class Code" has been added in place of ExtraInfo01 and ExtraInfo02.


Step 1 - Print the label

Let's begin by printing the label as it is so we can track the changes, as we make them.

You must do this from a mobile device.

Step 2 - Add the data

Using the event OnPrintLabel_OnAfterPopulateDataset, we can add Gross Weight and Warehouse Class Code to the label.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
    localprocedure Ex01OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
    var
        Item: Record Item;
    begin
        // Only relevant for Item labels
        // Item labels are always called with an Item. Else exit
        ifnot Item.Get(_Dataset.GetValue('ItemNumber')) then
            exit;

        // Set extrainfo fields and their labels, in the dataset
        _Dataset.SetValue('ExtraInfo01', Item."Gross Weight");
        _Dataset.SetValue('ExtraInfo01_Label', Item.FieldCaption("Gross Weight"));

        _Dataset.SetValue('ExtraInfo02', Item."Warehouse Class Code");
        _Dataset.SetValue('ExtraInfo02_Label', Item.FieldCaption("Warehouse Class Code"));
    end;


Step 3

Verify data is sent to the cloud.

...

Here we can see Gross Weight and Warehouse Class Code is included in the dataset / request..


See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
reversetrue
titleSee also
excerptTypesimple
cqllabel = "example" and label = "print"

...