...
...
...
...
...
...
...
...
...
...
Description
Excerpt |
---|
Skip collecting printer name when printing a label |
Use case
If you can determine the printer based on label template name, context, user name, etc. then you may skip collecting printer-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 OnLookupOnPrintLabelOnLookupOnPrintReport_OnAfterAddStepForTemplateOnAfterAddStepForReport
// [Example] Hide printer step, instead of collecting the value, set a (hidden) default value
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Report Print Lookup", '
...
OnLookupOnPrintReport_
...
OnAfterAddStepForReport', '', true, true)]
local procedure
...
MyOnLookupOnPrintReport_
...
OnAfterAddStepForReport(_
...
MobReport: Record"MOB Report"; var _
...
RequestValues: Record"MOB
...
NS Request Element"; _SourceRecRef: RecordRef; var _
...
Step: Record"MOB
...
Steps Element");
var
...
MobReportPrinter: Record"MOB Report Printer";
begin
// Making sure we only handle relevant label templates
ifnot _
...
MobReport."Display Name".Contains('3x2') then
exit;
// Making sure we only handle the relevant step
if _Step.Get_name() <>'ReportPrinter'then
exit;
// Find the printer to use
...
MobReportPrinter.FindFirst();
...
// Set defaultValue and hide printer-step
...
_Step.
...
Set_defaultValue(
...
MobReportPrinter."Printer Name");
...
...
_Step.Set_visible(false);
...
end;
...
See also
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|