Use this event to
Add new steps to label template
See also:
Standard Label Template Designs
OnLookupOnPrintLabel_OnAfterAddStepForTemplate
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate', '', true, true)]
local procedure OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
begin
end;
Example 1: Collect additional steps
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate', '', true, true)]
local procedure My01OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
var
Item: Record Item;
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'My custom Label-Template' then
exit;
// Collect additional Steps
// If ItemNo is already collected/transferred to Dataset display the item information, otherwise collect ItemNumber
if Item.Get(_Dataset.GetValue('ItemNo')) then
_Steps.Create_InformationStep(10, 'InfoStep', 'Information', '', 'You are printing with Item:' + Item."No.")
else
_Steps.Create_TextStep_ItemNumber(10);
// Collect which printer to print to and number of labels
_Steps.Create_ListStep_Printer(80, CopyStr(_TemplateName, 1, 50));
_Steps.Create_DecimalStep_NoOfCopies(90);
end;
Example 02: Reading values the context/source record (Purchase Line)
You can use the Source Record to determine which steps to collect, setting default values etc.
// [Example 02] Reading values the context/source record (Purchase Line)
// You can use the Source Record to determine which steps to collect, setting default values etc.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate', '', true, true)]
local procedure My02OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
var
Item: Record Item;
PurchaseLine: Record "Purchase Line";
begin
// Making sure the source table is one we can handle
if _SourceRecRef.Number() <> Database::"Purchase Line" then
exit;
// Use RecordRef to get the actual source record
_SourceRecRef.SetTable(PurchaseLine);
PurchaseLine.SetView(_SourceRecRef.GetView());
// Get Item and show an information step
if PurchaseLine.Type = PurchaseLine.Type::Item then begin
Item.Get(PurchaseLine."No.");
_Steps.Create_InformationStep(10, 'InfoStep', 'Information', '', 'You are printing with Item:' + Item."No.")
end;
end;
More examples
-
(Legacy) Case: Print muliple labels with unique lot numbers (MOB5.23-MOB5.38) — Option to generate and print multiple unique labels
-
Case: Print Customized License Plate Contents label (Cloud Print) — Modify the column and lines on License Plate Contents.
-
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 Label on Tote Shipping Posting (Cloud Print) — Print Label on the posting of Tote Shipping.
-
Case: Print muliple labels with unique lot numbers (Cloud Print) — Option to generate and print multiple unique labels
-
Case: Print your own ZPL labels (Cloud Print) — Print your own ZPL labels
-
Cloud Print: How to Copy a Label-Template to New — In this video, we will make a copy an existing label-template
-
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 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.
-
How-to: Add data to label-template (Cloud Print) — You want to modify a label template by adding data to it
-
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: Modify steps on a label-template (Cloud Print) — Modify collected steps before a Label-template is printed.
Version History
Version | Changes |
---|---|
MOB5.16 | Introduced |