Dynamics AX Blog - Dynamics AX 4.0 - Posts from 2008
These posts are machine-translated.
Currently, only posts are displayed, which are relevant for Dynamics AX version »Dynamics AX 4.0« 
RSS-Feed of this version

RSS-Feed of this version
Currently, only posts from »2008« are displayed
Dynamics AX: Print SalesInvoice through codeUsing the following code you can easily print sales invoice through code. With slight modifications to the code, this is also true for all other sales- and purchase-sided documents. Short example in AX 2009 static void PrintSalesInvoice(Args _args) { custInvoiceJour custInvoiceJour; SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice, false); PrintJobSettings printJobSettings = new PrintJobSettings(); Args args = new Args(); boolean prompt = true; boolean printIt = true; ; if (prompt) { // Dialog printIt = printJobSettings.printerSettings('SysPrintForm'); } else { // Printjobsettings printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat::PDF); printJobSettings.fileName(@'c: empmyfile.pdf'); } if (!printIt) { return; } salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select firstOnly custInvoiceJour where custInvoiceJour.salesid == '100001'; args.record(custInvoiceJour); args.caller(salesFormLetter); new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args); } Short example in AX 4.0 static void PrintSalesInvoice(Args _args) { custInvoiceJour custInvoiceJour; SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice, false); PrintJobSettings printJobSettings = new PrintJobSettings(); Args args = new Args(); boolean prompt = true; boolean printIt = true; salesPrintSetup salesPrintSetup; ; if (prompt) { // Dialog printJobSettings = new PrintJobSettings(salesPrintSetup.PrintJobSettings); printIt = printJobSettings.printerSettings('SysPrintForm'); salesPrintSetup.PrintJobSettings = printJobSettings.packPrintJobSettings(); } else { // Printjobsettings printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat::PDF); printJobSettings.fileName(@'c: empmyfile.pdf'); } if (!printIt) { return; } salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select firstOnly custInvoiceJour where custInvoiceJour.salesid == '100001'; args.record(custInvoiceJour); args.caller(salesFormLetter); new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args); } |
|
|
|
|
|
|
If you try to change the AllowDuplicates-Property of a table index from No to Yes, the following error message may occur:
In this case, presumably, the affected index is registered as PrimaryIndex or ClusteredIndex of the table.