Description
You want to modify a label template by adding data to it
In this example, we will be adding these fields to an Item Label.
- Gross Weight
- Warehouse Class Code
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 fields.
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.
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)]
local procedure 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 a RecordRef for "Item". Else exit
if _SourceRecRef.Number = database::Item then
_SourceRecRef.SetTable(Item)
else
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
See also
See also
-
How-to: Modify steps on a label-template (Cloud Print) — Modify collected steps before a Label-template is printed.
-
How-to: Add new/Copy a label-template (Cloud Print) — You want to add/create a custom label template with a unique design
-
How-to: Add data to label-template (Cloud Print) — You want to modify a label template by adding data to it
-
Cloud Print: How to modify label-template and add data — In this video, you will be introduced to modifying the design of a label template, using the designer, and adding data using AL code.
-
Cloud Print: How to modify label-template — In this video, you will be introduced to modify the design of a label-template, using the designer.
-
Cloud Print: How to Copy a Label-Template to New — In this video, we will make a copy an existing label-template
-
Case: Print your own ZPL labels (Cloud Print) — Print your own ZPL labels
-
Case: Print muliple labels with unique lot numbers (Cloud Print) — Option to generate and print multiple unique labels
-
Case: Print Label on Tote Shipping Posting (Cloud Print) — Print Label on the posting of Tote Shipping.
-
Case: Print Label on Planned Function Posting (Cloud Print) — Print Label on Planned Posting, i.e. Receive, Pick, Put-away, Ship, Move etc.
-
Case: Print Customized License Plate Contents label (Cloud Print) — Modify the column and lines on License Plate Contents.
-
(Legacy) Case: Print muliple labels with unique lot numbers (MOB5.23-MOB5.38) — Option to generate and print multiple unique labels