Hi all,
i'm tring to run a report during the posting of a ledger journal table to print a proforma invoice for a vendor. In AX 2012 it worked by customizing the post VendVoucher.post() method calling the the report by menuFunction. So in 365 i have extened the VendVoucher this way:
[ExtensionOf(ClassStr(VendVoucher))]
final class PAC001aVendVoucher_Extension
{
public void post(LedgerVoucher _ledgerPostingJournal,
CustVendTrans _vendTrans,
NoYes _approval,
UnknownNoYes _euroTriangulation,
boolean _withHoldTaxType,
boolean _useSubLedger)
{
ledgerJournalTable ledgerJournalTable;
ledgerJournalTrans ledgerJournalTrans;
;
ttsbegin;
next post(_ledgerPostingJournal, _vendTrans, _approval, _euroTriangulation, _withHoldTaxType, _useSubLedger);
if (common.TableId == tablenum(LedgerJournalTrans))
{
LedgerJournalTrans = common;
ledgerJournalTable = LedgerJournalTrans.ledgerJournalTable();
}
if(ledgerJournalTable.PAC001aPrintProforma)
this.PAC001aCommissionPrintJournal(vendInvoiceJour);
ttscommit;
}
void PAC001aCommissionPrintJournal(vendInvoiceJour _vendInvoiceJour)
{
Args args;
;
_vendInvoiceJour.Proforma = NoYes::Yes;
args = new Args();
args.name(identifierStr(PurchInvoiceOriginal));
args.record(_vendInvoiceJour);
new menuFunction('PAC001aAgentProformaInvoice', MenuItemType::Output).run(args);
//new menuFunction('PurchInvoiceOriginal', MenuItemType::Output).run(args);
throw error(strFmt("%1 %2", "@SYS119253",_vendInvoiceJour.vendName()));
}
}
where the throw error is needed beacuse i want to rollback the process after the report has printed to screen.
In Ax 365 this gives me the error :
"Stack trace: Cannot run form on non interactive session"
Someone can halp me to print the report and rollback as i can do in ax 2012?