Posts

Showing posts from June, 2020

CoC of Pack() & unPack() For Batch Classes And Adding Variables In Standard Macro

[ExtensionOf(classStr(ReqTransPoMarkFirm))] final class MyReqTransPoMarkFirm_Extension {     private NoYesId             booleanGroupBy;       #DEFINE.CurrentVersion(17)     #LOCALMACRO.CurrentList         booleanGroupBy     #ENDMACRO       public container pack()     {         container packedClass = next pack();         return SysPackExtensions::appendExtension(packedClass, classStr(MyReqTransPoMarkFirm_Extension), this.myPack());     }     private boolean myUnpack(container packedClass)     {         Integer version = RunBase::getVersion(packedClass);         switch (version)         {             case #CurrentVersion:                 [versio...

Modified Event Handler In D365 AX X++ Fianance & Operations

[DataEventHandler(tableStr(InventJournalTable), DataEventType::ModifiedField)] public static void InventJournalTable_onModifiedField(Common sender, DataEventArgs e)     {         InventJournalTable                  inventJournalTable = sender;         ModifyFieldEventArgs           args = e as ModifyFieldEventArgs;         FieldId                                     fieldId = args.parmFieldId();                   switch(fieldId)             {                 case fieldNum(InventJournalTable, InventSiteId) :                     //Logic         ...

Create Transfer Order Line Through Code AX X++ D365 Finance & Operations

    public void createPurchLine(ItemId _ItemId, InventDimId _InventDimId, Qty _qty SalesId _salesId)     {         InventTransferLine                      inventTransferLineNew;         InventDim                                    inventDimLocal;         InventTransferTable                     inventTransferTable = InventTransferTable::find(_inventTransferId);         inventDimLocal                          = InventDim::find(_InventDimId, );         inventDimLocal.InventSiteId     = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventSiteId;        ...

Create Purchase Order Line Through Code AX X++ D365 Finance & Operations

    public void createPurchLine(ItemId _ItemId, InventDimId _InventDimId, Qty _qty SalesId _salesId)     {         PurchLine                               purchLine;         InventTable                             inventTable;         InventDim                               inventDim;         InventLocation                          inventLocation;              InventItemBarcode                       inventBarCode;         PurchTable            ...

Create Sales Line Through Code AX X++ D365 Finance & Operations

public void createSalesLine(ItemId _ItemId, InventDimId _InventDimId, Qty _qty SalesId _salesId)     {         SalesLine                               salesLine;         InventTable                            inventTable;         InventDim                              inventDim;         InventLocation                       inventLocation;         InventItemBarcode                 inventBarCode;         SalesTable                               salesT...

Counting Journal Line Creation Through Code AX X++ D365

 public boolean createCountJourLines(ItemId _itemId, InventDimId _inventDimId, Real _qty, InventJournalId _inventJournalId)     {           InventTable                                   inventTable;         InventJournalTable                      inventJournalTable = InventJournalTable::find(_inventJournalId);         InventItemBarcode                       inventBarCode;         InventDim                                    inventDim;         InventLocation                             inventLocat...

Database restoration in finance & operations D365 AX

******************************************************************************* 1.Run command prompt as an administrator. 2.Run the below command to Import the database. cd C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin SqlPackage.exe /a:import /sf:J:\BackupFile.bacpac /tsn:localhost /tdn:AxDB_New /p:CommandTimeout=1200 where, •tsn (target server name) – The name of the SQL Server to import into. •tdn (target database name) – The name of the database to import into. The database should not already exist. •sf (source file) – The path and name of the file to import from. ********************************************************** Go to > windows > Microsoft SQL server Tools  > Microsoft SQL server Management > run as Administrator use > sql server Authentication > user "axdbadmin" and respective password (from LCS) Execute below queries one by one :- USE [AxDB_New] GO CREATE USER axdeployuser FROM LOGIN axdeployuser EXEC sp_addrole...

Sales order creation from sales quotation through code AX 2012/D365 x++

public void createSalesOrder(FormDataSource _SalesOrderDS) { int recordsCount; SalesQuotationLine salesQuotationLine; SalesQuotationTable salesQuotationTable; SalesTable salesTable; SalesLine salesLine; NumberSeq numberSeq; boolean headerCreated = false; recordsCount = _SalesOrderDS.recordsMarked().lastIndex(); salesQuotationLine = _SalesOrderDS.getFirst(1); ttsbegin; while (salesQuotationLine) { try { if (!headerCreated) { salesQuotationTable = salesQuotationLine.salesQuotationTable(); salesTable.clear(); numberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequenceTable().NumberSequence); salesTable.SalesId = numberSeq.num(); salesTable.initValue(); salesTable.initFromSalesQuotationTable(salesQuotationTable); salesTable.S...