Hi Techies,
I have written a custom process where SSRS report is downloading a pdf file twice if it matches certain criteria.
Below are two screenshots to help you understand bit more. Commercial invoice button calls a custom code with selected Load Id and opens a screen where user can add print setup, as shown below setting is selected as file and on executing two files are downloading because it's matching criteria on load lines.


This works fine on VM. Whereas it is very inconsistent on SIT environment. It was working till now, abruptly it started downloading only second file (_2).
Controller class is getting called twice. Upon debugging code works fine on DEV. It worked on SIT also but it's inconsistent. Can anyone give some inputs in this issue. Is there any additional code I can add here or something is missing from configuration side.
public static void main(Args _args)
{
CommercialInvoiceController commercialInvoiceController;
if (_args.parm()
|| (_args.record() && _args.dataset() == tableNum(WHSLoadTable)
|| _args.dataset() == tableNum(BIGCommercialInvoiceJournal)))
{
commercialInvoiceController = new BIGCommercialInvoiceController();
commercialInvoiceController.parmArgs(_args);
commercialInvoiceController.parmReportName(ssrsReportStr(CommercialInvoiceReport, Report));
commercialInvoiceController.parmDialogCaption("@ShowingCommercialInvoice");
commercialInvoiceController.parmShowDialog(false);
if (_args.caller() is CommercialInvoiceProcessJournal)
{
SRSPrintDestinationSettings printSettings;
Filename filepath;
Filename filename;
Filename fileType;
printSettings = _args.caller().parmPrintJobSettings();
Filename reportFileName = printSettings.parmFileName();
if (reportFileName)
{
[filepath, filename, fileType] = fileNameSplit(reportFileName);
if (_args.caller().parmPrintCounter() == 2)
{
filename = subStr(filename, 1, strLen(filename)-2);
}
reportFileName = strFmt("%1%2%3%4",filename,"_",_args.caller().parmPrintCounter(),fileType);
printSettings.parmFileName(reportFileName);
}
commercialInvoiceController.parmReportContract().parmPrintSettings(printSettings);
}
commercialInvoiceController.startOperation();
}
else
{
throw error(Error::wrongUseOfFunction(funcname()));
}
}
Thank you in advance!
Regards,
Sangram