Create Sale Order using AIF service AX2012 X++
SalesSalesOrderService will be required to place sales order. it is predefined service in AX2012. you will just need to perform following steps. 1- Register Service (right click on service –>Add-In –>Register Service) and . 2- System Administration –> Inbound ports –>{Add new salesorder service} On c# create salesorder like this. 3- Create c# web service…
Create Purchase Order And Post Invoice via X++
Following is X++ code to create purchase order and post the invoice using PurchFormLetter class. static void CreatePOAndInvoice(Args _args) { PurchTable purchTable; PurchLine purchLine; VendTable vendTable = VendTable::find(“1005”); AxPurchTable axPurchTable; AxPurchLine axPurchLine; PurchFormLetter purchFormLetter; //update site and warehouse locations. vendTable.InventSiteId =’DC’; vendTable.InventLocation = ‘TW’;…
Execute SQL in x++
server static void main(Args _args) { Connection connection; Statement statement; str query; Resultset resultSet; Str1260 test = “delay”; ; // create connection object connection = new Connection(); // create statement statement = connection.createStatement(); // Set the SQL statement query = “select…
AX 2012: Moving File to another Folder using System.IO.File X++
static void ArisMoveFileUsingSystemIOFile(Args _args) { #File Set permissionSet; Filename fPath; Filename fName; Filename fType; Filename sourcePath = @’D:\SourceFolder\test.csv’; FileName DestinationPath = @’D:\DestinationFolder\’; #define.sourcePath(sourcePath); #define.destinationPath(DestinationPath) permissionSet = new Set(Types::Class); permissionSet.add(new FileIOPermission(sourcePath,#io_write)); permissionSet.add(new InteropPermission(InteropKind::ClrInterop)); CodeAccessPermission::assertMultiple(permissionSet); [fPath, fName, fType] = fileNameSplit(sourcePath); System.IO.File::Move(sourcePath, strFmt(‘%1%2%3’, #destinationPath, fName, fType)); CodeAccessPermission::revertAssert(); Box::info(‘File\s moved successfully!’); }
D365FO | Ax2012: Create Counting Journal X++
public void CreateCountingJournal(JournalDescription _journalDescription, ItemId _itemId, InventQtyCounted _countedQuantity) { JournalCheckPost journalCheckPost; InventDim inventDim; InventDimParm tmpInventDimParm; InventJournalTrans journalTrans; InventJournalTable inventJournal; InventJournalName inventJournalName; JournalTableData journalTableData; InventSum inventSum; NumberSeq numberSeq; NumberSeq num; str journalName; str journalNum; int lineNum = 0; boolean errors; ; journalName = InventParameters::find().CountJournalNameId; num = new NumberSeq(); num = NumberSeq::newGetNum(InventParameters::numRefInventJournalId()); journalNum = num.num(); inventJournalName =…
D365FO: Create Counting Journal X++
public void CreateCountingJournal(JournalDescription _journalDescription, ItemId _itemId, InventQtyCounted _countedQuantity) { JournalCheckPost journalCheckPost; InventDim inventDim; InventDimParm tmpInventDimParm; InventJournalTrans journalTrans; InventJournalTable inventJournal; InventJournalName inventJournalName; JournalTableData journalTableData; InventSum inventSum; NumberSeq numberSeq; NumberSeq num; str journalName; str journalNum; int lineNum = 0; boolean errors; ; journalName = InventParameters::find().CountJournalNameId; num = new NumberSeq(); num = NumberSeq::newGetNum(InventParameters::numRefInventJournalId()); journalNum = num.num(); inventJournalName =…
AX 2012 | D365: 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…