static void postSalesInvoice(Args _args) { // Define a classvariable according to the // type of posting being performed SalesFormLetter_Invoice invoice; SalesTable salesTable; ; // Select the salesTable to update salesTable = SalesTable::find(“SO-101297″); // Create a new object of the SalesFormLetter_Invoice // by using the construct-method in SalesFormLetter invoice = SalesFormLetter::construct(DocumentStatus::Invoice); // Post the invoice invoice.update(salesTable, SystemDateGet(), SalesUpdate::All, AccountOrder::None, false, true); // Set to true to print the invoice } The next screenshot shows the class hierarchy of FormLetter with all its subclasses: we can easily custamize the above logic to post different status updates against sales orders and purchase orders Sales (Confirmation, Picking list, Packing slip, Invoice ) Purch (Purchase order,Receipt list, Packing slip, Invoice)