Hi Everyone,
I created a job to save free text invoices to PDF using SRSPrintDestinationSettings in a specific folder.
This is working fine. but, the issue is that create new sub-directory with a duplicate pdf file into this new folder.
static void AAl_printFreeTextInvoice2(Args _args)
{
SalesFormLetter salesFormLetter;
SRSPrintDestinationSettings settings;
FreeTextInvoiceContract freeTextInvoiceContract = new FreeTextInvoiceContract();
FreeTextInvoiceController freeTextInvoiceController = new FreeTextInvoiceController();
Args args = new Args();
CustInvoiceJour CustInvoiceJour;
;
select CustInvoiceJour where CustInvoiceJour.recid == 5637255489;
args.record(CustInvoiceJour);
args.parmEnumType(enumNum(PrintCopyOriginal));
args.parmEnum(PrintCopyOriginal::Original);
// Set the report data contract with parameters.
freeTextInvoiceContract.parmCustInvoiceJourRecId(CustInvoiceJour.RecId);
freeTextInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo());
freeTextInvoiceController.parmArgs(args);
freeTextInvoiceController.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesFreeTextInvoice).getDefaultReportFormat());
freeTextInvoiceController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
freeTextInvoiceController.parmShowDialog(false);
freeTextInvoiceController.parmReportContract().parmRdpContract(freeTextInvoiceContract);
freeTextInvoiceController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
freeTextInvoiceController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
freeTextInvoiceController.parmReportContract().parmPrintSettings().overwriteFile(true);
freeTextInvoiceController.parmReportContract().parmPrintSettings().fileName(@"C:\Users\xxx\Desktop\xxx\Tests\freeTextInvoice.pdf");
settings = freeTextInvoiceController.parmReportContract().parmPrintSettings();
salesFormLetter = SalesFormLetter::construct(DocumentStatus::FreeTextInvoice);
salesFormLetter.parmShowDialog(false);
salesFormLetter.updatePrinterSettingsFormLetter(settings.pack());
salesFormLetter.parmUseUserDefinedDestinations(true);
args.caller(salesFormLetter);
freeTextInvoiceController.parmArgs(args);
freeTextInvoiceController.startOperation();
}
The job save pdf and sub folder like this :

Can someone please point how can i solve this issue ?