Versions Compared

Key

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

Use this event to

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    procedure OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRefvar _Steps: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
    begin
    end;



Example 1: Collect additional steps

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    procedure Ex01OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRefvar _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

        // Check if Item No. is already collected/transferred to Dataset
        if Item.Get(_Dataset.GetValue('ItemNo')) then

            // Show an information step
            _Steps.Create_InformationStep(10'InfoStep''Information''''You are printing with Item:' + Item."No.")

        else
            // Collect the Item No.
            _Steps.Create_TextStep_ItemNumber(10);

        // Collect which printer to print to
        _Steps.Create_ListStep_Printer(80, CopyStr(_TemplateName, 150));

        // Collect the number of labels
        _Steps.Create_DecimalStep_NoOfLabelsNoOfCopies(90);
    end;


Example 02: Reading values the context/source record (Purchase Line)

...

 
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAddStepsForTemplate''', true, true)]
    procedure Ex02OnLookupOnPrintLabel_OnAddStepsForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRefvar _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());

        if PurchaseLine.Type = PurchaseLine.Type::Item then begin
            // Get item
            Item.Get(PurchaseLine."No.");

            // Show an information step
            _Steps.Create_InformationStep(10'InfoStep''Information''''You are printing with Item:' + Item."No.")
        end;
    end;


Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
titleMore examples
excerptTypesimple
cqllabel = "bc" and label = "print" and label = "example"

...