I use the following code to print multiple ssrs on the screen, and then export to pdf, but I found that the file name of all pdf is composed of the last printed salesid:
public static void main(Args _args)
{
utcDateTime timeInUserTz = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(), DateTimeUtil::getUserPreferredTimeZone());
// TODO: Review the format
str printTime = System.String::Format('{0:yyyyMMdd HH:mm}', timeInUserTz);
CustPackingSlipJour custPackingSlipJour = _args.record();
CustPackingSlipTrans custPackingSlipTransTmp,custPackingSlipTrans;
Set salesIdSet = new Set(Types::String);
while select OrigSalesId
from custPackingSlipTransTmp
group by OrigSalesId
where custPackingSlipTransTmp.SalesId == custPackingSlipJour.SalesId
&& custPackingSlipTransTmp.PackingSlipId == custPackingSlipJour.PackingSlipId
&& custPackingSlipTransTmp.DeliveryDate == custPackingSlipJour.DeliveryDate
{
salesIdSet.add(custPackingSlipTransTmp.OrigSalesId);
}
SetEnumerator enumerator = salesIdSet.getEnumerator();
while (enumerator.moveNext())
{
SalesId parmSalesId = enumerator.current();
DeliveryCreditNoteController controller = new DeliveryCreditNoteController();
controller.parmTableRecId(custPackingSlipJour.RecId);
controller.parmSalesId(parmSalesId);
controller.parmReportName(ssrsReportStr(DeliveryCreditNoteReport, Report));
controller.parmShowDialog(false);
**controller.parmDialogCaption(parmSalesId+'_'+printTime);**
SRSPrintDestinationSettings settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::Screen);
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
controller.startOperation();
}
}
I tried to use the
controller.parmDialogCaption(parmSalesId+'_'+printTime)
line of code to control the exported file name, but it didn’t work, how can I modify the code to achieve my purpose