web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Automatic report printing through DRA

(1) ShareShare
ReportReport
Posted on by 133
Hi everyone,
 
I have this requirement where I have to send the custom SSRS report to the printer automatically, after a certain activity completes.
So there's this warehouse app, from there users do some pick activity and on the last line of pick, I send this SSRS report to the printer.
 
Users select the printer on frontend, that is also a custom field. And it uses Document Routing Agent(DRA) for printing. 
 
So for testing in dev environment, we are using a dummy printer which we created, and it shows report in the queue of DRA. But when we do the same process in test environments, the automatic thing is not working, not even the dummy printer works. Now, we don't understand whether the problem is with code or configuration. So can someone please, look at the code and let me know if its correct or not.
Also if anyone can give any ideas/suggestion/solutions for this problem.
 
Note, that manual printing is working when someone clicks on the report's output menuitem.
 
Here's the code that I wrote in the controller to send the report to printer.
 
public PrinterName getPrinterName()
    {
        PrinterName     printerName;
        WHSWorkUser     whsWorkUser = WHSWorkUser::find(userId);
        WHSWorker       whsWorker = WHSWorker::find(whsWorkUser.Worker);
        DirPersonUser   personUser;
        HcmWorker       worker;
        printerName = whsWorkUser.DefaultPrinterNameHeader_Custom;
       
        if (!printerName)
        {
            throw error(/Default printer not found/);
        }
        return printerName;
    }
 
 
public static void main(Args _args)
    {
        WHSWorkController_Custom whsWorkController = new WHSWorkController_Custom();
        whsWorkController.parmReportName(ssrsReportStr(WorkPickReport_Custom, Report));
        whsWorkController.parmArgs(_args);
        whsWorkController.parmDialogCaption(/Work Pick Report/);
        whsWorkController.setRange(_args, whsWorkController.parmReportContract().parmQueryContracts().lookup(whsWorkController.getFirstQueryContractKey()));
        if(_args.menuItemName() == menuItemOutputStr(WorkPickMenuItem_Custom) && _args.parm() != '@SYS300876')
        {
            whsWorkController.parmShowDialog(true);
        }
        else
        {
            PrinterName printerName = whsWorkController.getPrinterName();
           
            SRSPrintDestinationSettings srsPrintDestinationSettings = new SRSPrintDestinationSettings();
            srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::Printer);
            srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::PDF);
            srsPrintDestinationSettings.printerName(printerName);
            whsWorkController.parmReportContract().parmPrintSettings(srsPrintDestinationSettings);
            whsWorkController.parmShowDialog(false);
        }
        whsWorkController.startOperation();
    }
 
And Here's the custom field which selects the printer name.//////////
 
Please provide some suggestion which could help with this thing.
 
Thanks,
Bhagyashree Dave
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288 Super User 2026 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 270 Most Valuable Professional

#3
Anton Venter Profile Picture

Anton Venter 217 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans