Saturday, March 8, 2014

Misconception and common guidelines on Dynamics AX 2012 infrastructures


Common misconception on infrastructures
Following points are gathered from the Microsoft training,
It includes some best practices also

1. Virtualization may be the smartest way of handling your infrastructures.
But having DAtabase server on virtualization seriously affect the performance of AX system. It reduces 14.5 % performance down compared to physical servers.

2. Putting more Memory and Processin...g power Wouldnt help if you dont know the sizing   guidelines
For example,
AOS Server Sizing,
5K Lines Per Hour Per Core (usually 4 to 12 core box)
2 GB Memory for Each Core (usually 4 to 8 GB per AOS instance)
User Concurrency is a good Marker. Based on Transaction Complexity, between 50 Users Per Core to 150 Users Per Core (average of 60)

3. Database Thumb rule is 2 to 6 GB memory for each CPU core. Next you have to set SQL Server maximum server memory correctly. Always leave a percentage for OS and other services running on the box
        
                                                                                                                            - to be continued

Friday, January 17, 2014

Total purchase invoice amount through X++

How to get a total invoice amount for a purchase order table, You had to take it in consideration for all the charges calculated (ex: tax). I tried to search the purchtable and purcline table for any existing methods. I found one class called purchtotals. there Microsoft calculating all the total amounts of incoice amount, order amount etc. Her...e is the code for this total calculation

PurchtotalsForm totalsForm;
;
totalsForm = PurchtotalsForm::newPurchTotalsForm(this, 1);
totalsForm.calctotals();
return totalsForm.invoiceAmountValue();

not only you can calculate invoice amount here is the list things you can get it from this class.

purchTaxTotal,
purchRoundOff,
purchTotalAmount,
purchTaxRoundOff,
purchCashDiscDate,
purchPrepayLimit,
purchPrepayAvailable,
purchTaxWithholdTotal

Friday, January 10, 2014

Import retail categories through code in dynamics ax 2012

Simple code to import Retail Product category

 EcoResCategory ecoResCategory
 ; 
 ecoResCategory.clear();
 ecoResCategory.initValue();
 ecoResCategory.initFromParent(EcoResCategory::findByName('HAL',ecoResCategory.CategoryHierarchy);
 ecoResCategory.Code = 'Test_categoryimport';
 ecoResCategory.Name = 'Test_Categoryimport';
 ecoResCategory.addToHierarchy();

import barcode through X++ in dynamics ax 2012

Some simple code for barcode import

 inventItemBarCode.barcodeSetupId = RetailInventTable::find(itemCode).BarcodeSetupId;
 inventItemBarCode.inventDimId = InventDim::findOrCreate(inventDim).inventDimId;
 inventItemBarCode.RetailVariantId = InventDimCombination::find(itemCode,inventItemBarCode.inventDimId).RetailVariantId;
 inventItemBarCode.itemId = itemCode;
 inventItemBarCode.description = InventTable::find(itemCode).defaultProductName();
 inventItemBarCode.UnitID = InventTable::find(itemCode).salesUnitId();
 inventItemBarCode.qty = qty;
 inventItemBarCode.useForInput = NoYes::Yes;
 inventItemBarCode.useForPrinting = NoYes::Yes;
 inventItemBarCode.itemBarCode = barcode;
 if(inventItemBarCode.validateWrite())
 inventItemBarCode.insert();

Partial sales order through code in Dynamics ax 2012 R2

I had been searching the internet to find the code. But i couldnt, every code leads to full invoice or line by line invoice. so i did some exploring to come up with a below code it will invoice partial quantity

I updated the partial sales invoice through code...

 SalesFormLetter salesFormLetter =  SalesFormLetter::construct(DocumentStatus::Invoice);
 SalesTable salesTAble;
 SalesParmLine parmLine;
 ;
 salesTable = SalesTable::find('FUAE-000002');
 salesFormLetter.salesTable(salesTAble);
 salesFormLetter.transDate (systemDateGet());
 salesFormLetter.specQty (SalesUpdate::All);
 //If you want proforma you can enable the code
 //salesFormLetter.proforma (true);
 //salesFormLetter.printFormLetter (true);
 salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.s alesParmUpdate());
 salesFormLetter.initParmSalesTable(salesTAble);

 salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
 salesFormLetter.initLinesQuery();
 while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
 {
 ttsBegin;
 parmLine.DeliverNow = 10;
 parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
 parmLine.setInventDeliverNow();
 parmLine.setLineAmount(); 
 parmLine.update();
 ttsCommit;
 }
 salesFormLetter.run();