Post an Sales invoice in D365 Finance & Operations X++
Views (508)
Below is the job I created for posting sales invoices.
class Test_PostPackingSlip
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
SalesTable _SalesTable;
SalesFormLetter_Invoice invoice;
ttsbegin;
_SalesTable.clear();
_SalesTable = SalesTable::find("SO00125116");
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
ttsCommit;
}
}
class Test_PostPackingSlip
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
SalesTable _SalesTable;
SalesFormLetter_Invoice invoice;
ttsbegin;
_SalesTable.clear();
_SalesTable = SalesTable::find("SO00125116");
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
ttsCommit;
}
}
This was originally posted here.

Like
Report
*This post is locked for comments