AX 2012: Post Packing Slip using X++

AX 2012: Post Packing Slip using X++

static void postPackingSlip(Args _args)
{
SalesFormLetter salesFormLetter;
SalesTable salesTable;
SalesId salesId = ‘SO00001’;
System.Exception error;
str strError;
CustPackingSlipJour custPackingSlipJour;
;

ttsBegin;
try
{
salesTable = SalesTable::find(salesId);

if (salesTable && salesTable.SalesStatus == SalesStatus::Backorder)
{
salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No);

if (salesFormLetter.parmJournalRecord().TableId == tableNum(custPackingSlipJour))
{
custPackingSlipJour = salesFormLetter.parmJournalRecord();
info(strFmt(‘New Packing Slip #:%1 successfully created for Sales Order #:%2’, custPackingSlipJour.PackingSlipId, custPackingSlipJour.SalesId));
}
}
else
{
info(strFmt(‘%1 does not exsists or null in the system, please try again!’, salesId));
}

}
catch (Exception::CLRError)
{
error = CLRInterop::getLastException();
strError = error.ToString();

info(strfmt(‘%1’, strError));
info(strFmt(‘%1 failed to delivered, please try again!’, salesId));
}
ttscommit;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s