Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description

Skip collecting printer name

Use case

When you can determine the printer name to use on a given context, user, label template, you can skip collecting the printer and save a step for the mobile user


Modify the printer step

We hide the step and set a default value. This way, the value is set, but the user will not be prompted.


    // [Example] Change an existing step : Add item description to existing InfoStep helpLabel
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnLookupOnPrintLabel_OnAfterAddStepForTemplate', '', true, true)]
    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-Template
        if not _TemplateName.Contains('MyLabel') then  // <--- Name of your label template
            exit;

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

        // Set defaultvalue and hide step
        if _Step.Get_name() = 'Printer' then begin
            _Step.Set_defaultValue(MobPrinter.Name);    
            _Step.Set_visible(false);
        end;
    end;


See also 


  • No labels