Saving product receipt SSRS report as archive whenever PO is received

Hello experts,

We have requirement to archive product receipt SSRS report whenever PO is received. We have few interfaces and periodic jobs which will create the product receipt from backend. If anyone has worked on similar requirement, please share details on automation.

I have started with following but I am not able to successfully pass the arguments hence getting blank report.
SrsReportRunController controller = new SrsReportRunController();
args args;
SRSPrintDestinationSettings printsettings;
args = new args();
args.record(vendpackingslipjour::findrecid(recId));
controller.parmreportname(ssrsreportstr(PurchPackingSlip, Report));
// get print settings from contract
printSettings = controller.parmReportContract().parmPrintSettings();
// set printer as the destination
printSettings.printMediumType(SRSPrintMediumType::Archive);

controller.parmShowDialog(false);
controller.parmArgs(args);
// start operation
controller.startOperation();

Best Regards,
Prashanth N

Hello Prashanth,

you mean to say in above code you are not able to pass correct recid?

if there are automatic jobs which are posting Packingslip i will suggest write code in the same job to get correct record

Hi Kunal,

Recid is coming correct, issue is even though I am calling controller.parmArgs(args); report displayed is blank.

Thanks,
Prashanth

Hello Prashanth

everything seems fine, try to use below code and also pass the recid hardcode for testing, goto table vendPackingslipjour and copy any recid and paste here.

args args = new args();

SRSPrintDestinationSettings printSettings;

PurchPackingSlipController controller = new PurchPackingSlipController();

args.record(vendpackingslipjour::findrecid(recId));

controller.parmReportName(ssrsReportStr(PurchPackingSlip, Report));

printSettings = controller.parmReportContract().parmPrintSettings();

printSettings.printMediumType(SRSPrintMediumType::Archive);

controller.parmShowDialog(false);

controller.parmArgs(args);

controller.startOperation();

Hi Kunal,

When you call controller.startoperation() all the settings you did above the line will be overridden in the PurchPackingSlipController class. So its not working.

try to replace it with controller.runReport();

Hi Kunal,

Thanks for the help, I have got the solution after debugging standard behavior

Contract.parmPrintFormletter(true);
Contract.parmUsePrintManagement(true);

We just need to set the above two parameters to true as we do it manually.