Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Description

Excerpt

Skip collecting printer name when printing a label


Use case

When If you can determine the printer name to use on a given based on label template name, context, user , label template, you can name, etc. then you may skip collecting the printer and save a step for the mobile userprinter-step 


Modify the printer step

We hide the step and we set a default value.

This way, the value is set, but the user will not be prompted.

Using event OnLookupOnPrintLabel_OnAfterAddStepForTemplate

    // [Example] Change an existing step : Add item description to existing InfoStep helpLabelHide printer step, instead of collecting the value, set a (hidden) default value
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAfterAddStepForTemplate', '', true, true)]
    local procedure MyOnLookupOnPrintLabel_OnAfterAddStepForTemplate(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Step: Record "MOB Steps Element"; var _Dataset: Record "MOB Common Element")
    var
        MobPrinter: Record "MOB Printer";
    begin


        // Making sure we only handle our own Label-Templaterelevant label templates
        ifnot _TemplateName.Contains('MyLabel3x2') then  // <--- Name of your label template
            exit;

        // Find the printer to use
        MobPrinter.FindFirst();  // <--- Consider making a setup for determining what printer to use

        // Set defaultvalue defaultValue and hide printer-step
        if _Step.Get_name() = 'Printer'thenbegin
            _Step.Set_defaultValue(MobPrinter.Name);    
            _Step.Set_visible(false);
        end;
    end;


See also 

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

...