Override printer selection with an event

In situations where the normal use of the Printer Selection page is not enough to select the right printer for the current user, there is an event to help you override the printer selection.

It is a standard event that is called before the request page is shown.

The following code is an example of how to subscribe to the event:

codeunit 50000 "Override Printer Selection"
    EventSubscriberInstance = StaticAutomatic;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Reporting Triggers",
        'GetPrinterName', '', true, true)]
    Procedure GetPrinterName(ReportID: Integer; var PrinterName: Text[250])
        PrinterName := 'Workstation 1';

Alternatively, you can use the OnAfterGetPrinterName event in the codeunit ReportManagement.