Saturday 1 September 2012

Printing and SalesFormLetter.update

We had a small modification done where the users are able to bulk post the sales orders. The modification used the following code to post the sales orders

salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.getLast();

printJobSettings = new PrintJobSettings(salesFormLetter.printerSettingsFormletter());
salesFormLetter.update(salesTable, SystemDateGet(), SalesUpdate::PickingList, AccountOrder::None, false, true);


Above code uses the last user printer settings and sends the print there. We recently discovered that in some cases the invoices were being printed but the order remained un-invoiced in the system. The problem started happening or being reported after we upgraded to AX2012. Apparently while the order is being invoiced, system sends the print and then something happens that causes the roll-back, but at this point the print is already out of the printer. The users were handing over the invoice to the customers without realizing that the order is not invoiced. Now the order can be invoiced again but it will produce another invoice number which is a problem as customer copy and the system won't match. We decided to print the invoice after the order is invoiced. Not sure whether there is a problem with salesFormLetter.update method or we were using it in a wrong way.

This posting is provided "AS IS" with no warranties. Use code at your own risk.