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