Reports: Use different report template instead of default report template design on generating CustFreeTextinvoice report

I have a requirement, based on some condition i have to choose different report template design.

  1. For normal Freetextinvoice, i am using default report template “Report”

  2. For special type of invoice, i want to use another report template “someothername*”.

where should i change to tell the printmanager to use another template(“someothername*”) instead of default report template(“Report”) while generating the report?

Thanks for any help.

What exactly do you want to achieve? To add an additional document type to print management setup? Or to select some report design at runtime (based on some business logic), ignoring the designed configured in print management? Or something else?

Thanks for reply, i want to select report some other design at runtime to generate custom report design(instead of default).

In which version of AX?

AX 2012 CU7

If your condition is met, simply set the new design name (this.parmReportName(ssrsReportStr(ReportName, DesignName)) in FreeTextInvoiceController class.

In which method i have to add the above line. thanks for your help

I don’t know. It depends on the logic you’re implementing.

Thanks, if i want to setup different Report format on Printmanagement, how i can change to choose another format on the Printmanagement UI, it shows only one default report. i am just checking this can solve my problem instead of changing code.

Thanks for your help.

So it’s not true anymore that your need to select the design by some logic at runtime?

It is not like that. i am looking what could be the better solutions for my requirement. If there are multiple ways of doing, i am trying to figure which one is suitable. Thanks for helping.

But what’s the requirement? Once you talk about a decision at runtime, then about static definition in a parameter. These are two different things; solutions for completely different requirements. You can’t use them interchangeably.

And I obviously can’t know your requirements unless you explain them.

Here is my requirement:

i am using AIF FreetextinvoiceService to create Freetextinvoices in AX. while generating the normal invoices i am also printing and saving reports as pdf with default report design. i have another requirement to generate special invoice which should endup generating report as pdf with different invoice report design.

And i also use the print management to send the invoices to customers via printmanagement as email. In this case i want to change the report design when sending special invoice reports.

Any help appreciated. Thanks

Where is the logic to decide which design to use?

SRSPrintDestinationSettings printSettings;

CustInvoicePrintJob printJob;

printSettings = new SRSPrintDestinationSettings();

printSettings.printMediumType(SRSPrintMediumType::File);

printSettings.fileFormat(SRSReportFileFormat::PDF);

printSettings.overwriteFile(true);

printSettings.fileName(_filePath);

printJob = CustInvoicePrintJob::newCustInvoicesToPrint(CustInvoicesToPrint::FreeText);

printJob.parmFromInvoiceId(_invoiceId);

printJob.parmPrintCopyOriginal(PrintCopyOriginal::Original);

printJob.parmPrinterSettingsOriginal(printSettings.pack());

printJob.parmUsePrintManagementDest(false);

printJob.run();

this is the code i am using. at the printJob.run(), it is generating the pdf.

i debugged through the code, no where found the default report name to pick. i may be missed [:(].

Yes, I know how to print into PDF, thank you. How is it related to your problem with the alternative design?

i believe, during this process the default design is selected and saved. i would like to change the design while runtime. i need to to know where to change the design name. i don’t have full understanding how Reports generation work in AX. i really appreciate for your time and help. Please reply

Sorry, but we already had this discussion. I told you how to do it and that the location depends on the logic you want to implement.

I tried changing on the FreeTextInvoiceController class Main method

i commented below code and added what you gave me, still it generated the default report.

//controller.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesFreeTextInvoice).getDefaultReportFormat());

I changed to controller.parmReportName(ssrsReportStr(FreeTextInvoice, designname));