27 February 2014

Microsoft Dynamics AX 2012 R3 technical features

Hi Guys, There are some major changes in AX 2012 R3 as follows

1.Automated deployment of AX 2012R3 in Windows Azure
2.Building Microsoft AX services integration with the Microsoft Windows Azure Service Bus
3.Data synchronization to multiple instances of Microsoft Dynamics AX
4.Optimizing the performance of Microsoft Dynamics AX deployment
5.Create Microsoft Dynamics AX builds using the new X++ server-side parallel compiler


Happy Daxing.. :-)

06 February 2014

Write data to text file in AX 2012 and AX 2009

static void writeDataToTxt(Args _args)
{

CustTable custTable;
BinData binData;
TextBuffer textBuffer;
;

textBuffer = new TextBuffer();
textBuffer.setText('');

while select custTable
{
textBuffer.appendText(strfmt('%1\r\n',custTable.AccountNum));
}

textBuffer.getText();

binData = new BinData();
binData.setStrData(textBuffer.getText());
binData.saveFile(@"C:\fileOUt\test.txt");

}

01 February 2014

Queries query classes example in AX 2012

static void Query_cntRecords(Args _args)
{
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource qbd;
int64 iCountRecords;
;

qbd = query.addDataSource(tablenum(CustTable));
queryRun = new QueryRun(query);
iCountRecords = SysQuery::countTotal(queryRun);

info(strfmt("Total Records in Query %1", SysQuery::countTotal(queryRun)));

}

Dialog Runbase Example in AX 2012

class Runbase_Example extends RunBase
{
TransDate fromDate,toDate;
CustAccount custAccount;

DialogField dlgFromDate,dlgToDate,custDldField;

#define.CurrentVersion(1)
#localmacro.CurrentList
fromDate,toDate
#endmacro
}
protected Object dialog()
{
DialogRunbase dialog;

dialog = super();
dialog = super();
custDldField = dialog.addFieldValue(extendedTypeStr(CustAccount),custAccount);
dlgFromDate = dialog.addFieldValue(extendedTypeStr(TransDate),fromDate);
dlgToDate = dialog.addFieldValue(extendedTypeStr(TransDate),toDate);

return dialog;
}
public boolean getFromDialog()
{
boolean ret;

ret = super();
custAccount = custDldField.value();
fromDate = dlgFromDate.value();
toDate = dlgToDate.value();

return ret;
}
public container pack()
{
return [#CurrentVersion,#CurrentList];
}
public boolean unpack(container packedClass)
{
Version version = RunBase::getVersion(packedClass);
switch (version)
{
case #CurrentVersion:
[version,#CurrentList] = packedClass;
break;
default:
return false;
}
return true;
}
public static void main(Args args)
{
Runbase_Example runb = new Runbase_Example();

if(runb.prompt())
{
runb.run();
}
}

create new number sequence by x++ code in AX 2012

static void DemoNumberSeq(Args _args)
{
NumberSeq numberSeq;
Str salesId;
ttsbegin;
numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
salesId = numberSeq.num(); 
ttscommit;
info(strFmt("%1",salesId));
}

How it works
1.NumberSeq Table act as master table for numberseq code , which stores
format to be generated , next sequence etc.
2.NumberSequenceReferences stores all the references and their corresponding
numberseq codes.
3.As shown in the above code , NumberSeq class needs numberseqreference ,
i,e "EDT. Unique Id for the Process " So first get the references by
passing an EDT as parameter to the findReference method of numberseqreference
class.Than you can call numberSeq.num() method to generate the number
for you.
4.Use NumberSeqFormHandler class if you want to use the numbersequencs on form.

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...