Author: Mohammed Salah

Desterilize API response and adding List of object into table X++

try { ttsbegin; { Microsoft.Dynamics.Ax.Xpp.List dataList = new Microsoft.Dynamics.Ax.Xpp.List(Microsoft.Dynamics.Ax.Xpp.Types::Record); Microsoft.Dynamics.Ax.Xpp.List itemList = new Microsoft.Dynamics.Ax.Xpp.List(Microsoft.Dynamics.Ax.Xpp.Types::Record); Microsoft.Dynamics.Ax.Xpp.ListIterator dataListIterator; Microsoft.Dynamics.Ax.Xpp.ListIterator itemListIterator; Microsoft.Dynamics.Ax.Xpp.ListIterator piovttIterator; BIAPISetup _apiSetup; select firstonly _apiSetup order by _apiSetup.RecId desc ; date requestDate; str requeststr; int numofdays; BIInventCountsContracrt _inventCountsContracrt= new BIInventCountsContracrt(); BIInventCountsData _inventCountsData= new BIInventCountsData(); BIInventCountItemData _inventCountItemData= new BIInventCountItemData(); BIBranchData _branchData= new BIBranchData(); BIInventCountPivotData _piovtData= new…

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’;…

D365 : MULTI-SELECT LOOKUP FOR SSRS REPORT DIALOG

WRITTEN BY MUHAMMADANASKHANDECEMBER 12, 2014 Overview: In this post we’ll learn how to build multi-select lookup for SSRS report dialog. We’ll create an RDP report with an AutoDesign layout. Controller will be used to run the report. An output menu item will be created to point to the controller class. Each AOT element involved will be…

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 =…