Versions Compared


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


Mobile WMS Extension version MOB5.39 (or newer)
Android App version 1.5.9

An older version of this article exists, see (Legacy) Case: Print muliple labels with unique lot numbers (MOB5.23-MOB5.38)



Option to generate and print multiple unique labels

Proposed solution

You are happy with the ability to print a label based on a desired Lot number, but:

The process can be optimized when mulitple labels are needed.

So you want to the system to automatically generate a number of labels and assign them unique Lot numbers.

Use case  

  • The user enters Lot when asked during printing = One label
  • The user Leaves the Lot step = blank
    • This triggers another step that asks for how many unique labels should be generated = Multiple unique labels

This solution could be a good fit for:

  • Production Output
  • Warehouse Receipts

The solution can be modifed for use with Serial No.

Step 1: Allow for blank Lot -step value

 In order to determine when to print multiple labels, we must modify the existing Lot -step using OnLookupOnPrintLabel_OnAfterAddStepForTemplate


[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAfterAddStepForTemplate', '', true, true)]
    localprocedure OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Step: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
        if _Step.Get_name() = 'LotNumber'then
            _Step.Set_optional(true); // Now optional = Blank is now allowed

entral : NTW-1677-docs-add-case-for-multilpe-labels

Step 2: Insert Step to ask user for the number of unique labels to generate

  • Since PrintLabel is is an Unplanned Function we can use Return steps on Post to insert a new step called "UniqueLabels".
  • This step will allow us to determine when and how many labels to generate

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps', '', true, true)]
    localprocedure MyOnPostAdhocRegistration_OnAddSteps(_RegistrationType: Text; var _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
        MobTrackingSetup: Record "MOB Tracking Setup";
        MobReservationMgt: Codeunit "MOB Reservation Mgt.";
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
        RegisterSerialNumber: Boolean;
        RegisterLotNumber: Boolean;
        RegisterExpirationDate: Boolean;
        // Only handle printing
        if _RegistrationType <> MobWmsToolbox."CONST::PrintLabelTemplate"() then

        // Step has already been added and user has filled it out
        if _RequestValues.GetValueAsInteger('UniqueLabels') > 0then

        // Check whether Lot-step is to be expected and the collected value from LotNumber-step
        MobReservationMgtMobTrackingSetup.DetermineSpecificTrackingFromItemNoDetermineSpecificTrackingRequiredFromItemNo(_RequestValues.Get_ItemNumber(), RegisterSerialNumber, RegisterLotNumber, RegisterExpirationDateRegisterExpirationDate);

        // Create step to determine how many labels to generate
        if RegisterLotNumber and (_RequestValues.GetValue('LotNumber') MobTrackingSetup."Lot No. Required" and (MobTrackingSetup."Lot No." = '') thenbegin
            _Steps.Create_IntegerStep(99, 'UniqueLabels', 'How many unique labels do you want?');
            _Steps.Set_helpLabel('You did not enter Lot No. How many labels should be generated?');

Step 3: Generate multiple labels

Now that we have collected "UniqueLabels" -step, we must use OnPrintLabel_OnAfterPopulateDataset to:

  • Lookup Item and No. series
  • Get next number from No. Series
  • Generate the labels with the desired Lot number

[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 _RequestValues: Record "MOB NS Request Element")
        Item: Record Item;
        NoSeriesManagement: Codeunit NoSeriesManagement;
        UniqueLabels: Integer;
        i: Integer;
        // Making sure we only handle the right label-template
        // Change this name to your own label-template
        ifnot _TemplateName.Contains('Item Label') then

        // Get item being printed
        Item.TestField("Lot Nos."); // Must have no series

        // No of labels (collected from user)
        UniqueLabels := _RequestValues.GetValueAsInteger('UniqueLabels');


        for i := 0to UniqueLabels dobegin
            if i > 1then// Create additional labels/datasets for the remaining LotNumbers in the sequence

            _Dataset.SetValue('LabelNumber', i);
            _Dataset.SetValue('LotNumber', NoSeriesManagement.GetNextNo(Item."Lot Nos.", WorkDate(), true));


The result

Note the incremented Lot numbers