How-to: Modify steps on a label-template (Cloud Print)
Requirement
Mobile WMS Extension MOB5.16
Description
Modify collected steps before a Label-template is printed.
- You are not happy with the steps being collected as default by a template handler.
- Or you have created a custom Template and want to add some steps to collect information used on the printed label.
This approach works for all templates, standard or custom.
Add a Step and remove a Step
In the following example we will be:
- Making sure we are only handling our own template.
- Adding an Information Step
- Removing an unwanted step
Using the event OnLookupOnPrintLabel_OnAddStepsForTemplate
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate', '', true, true)]
local procedure MyOnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; var _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
var
Item: Record Item;
begin
// Make sure we only handle our own Label-Template
if _TemplateName <> 'MyItemLabel' then
exit;
// Check if Item No. is already collected/transferred to Dataset
if Item.Get(_Dataset.GetValue('ItemNumber')) then
// Add an information step using the Item no.
_Steps.Create_InformationStep(10, 'InfoStep', 'Information', '', 'You are printing with Item:' + Item."No.");
// Delete the unwanted Quantity-step
_Steps.SetRange(name, 'QuantityPerLabel');
if _Steps.FindFirst() then
_Steps.Set_visible(false);
_Steps.SetRange(name); // Reset the filter so the next event is not affected by you
end;
Inspect the functionality
Your device should look this this.
Modify the behavior of the Template Handler further
- All Values and display Labels can be changed through customization.
- Additional values can collected using “Steps” – or you can change existing steps.
- Find more examples on OnLookupOnPrintLabel_OnAddStepsForTemplate or in the links below
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.