How to Restore deleted sales order or purchase order Ax 2012 ?
If the parameter 'Mark
order as voided' is enabled in the Accounts receivable parameters, you can find the deleted order in the form "Voided sales orders" that can be found under Sales and marketing/Inquiries/History/Voided sales orders.
In fact the history tables contains sent Confirmations, Packing slips and Invoices.
In fact the history tables contains sent Confirmations, Packing slips and Invoices.
Sales order restoration:
static void restoreDeletedSO(Args _args)
{
SalesTableDelete salesTableDelete;
SalesLineDelete salesLineDelete;
SalesTable salesTable;
SalesLine salesLine;
;
SalesTableDelete = SalesTableDelete::find(‘00450_036′, true);
ttsbegin;
switch (salesTableDelete.Cancelled)
{
case Voided::Voided :
salesTable = conpeek(salesTableDelete.SalesTable, 1);
salesTable.insert();
while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
{
salesLine = conpeek(salesLineDelete.SalesLine, 1);
salesLine.insert();
}
salesTableDelete.delete();
break;
case Voided::linesVoided :
while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
{
salesLine = conpeek(salesLineDelete.SalesLine, 1);
salesLine.insert();
salesLineDelete.delete();
}
salesTableDelete.delete();
break;
}
ttscommit;
}
Thanks & Regards
Sindhu