Sunday, November 16, 2008
Financial posting in dynamics ax
Answer: The API documentation can be found at http://download.microsoft.com/download/d/b/a/dba4455a-25c1-495c-bad2-3b316e0e2434/PostToLedger.pdf . Also I have written a blog entry for this you can check that out as well.
Friday, November 14, 2008
Inside Dynamics AX 4.0 Free eBook download at microsoft
How to catch key stokes in Dynamics AX
Answer: Override the task() method of the form and add a case in the switch method to check the keystroke. The task macro is available in the macro library that can be used to catch different events.
Monday, November 10, 2008
Microsoft Dynamics AX: AX 2009 Documents - Arijit Basu | Dynamics AX MVP
Microsoft Dynamics AX: AX 2009 Documents - Arijit Basu Dynamics AX MVP
Dynamics AX and Economic Crisis
http://dynamics-ax.blogspot.com/2008/11/dynamics-ax-in-recession.html .
Enjoy!
Friday, November 7, 2008
LIKE statement in Dynamcis AX
Answer: We can use 'like' clause in Dynamics AX statement by using '*' in the wild cards.
static void likeStatement(Args _args)
{
CustTable custTable;
;
while select custTable where custTable.Name like '*The*'
{
print custTable.Name;
}
pause;
}
In order to use linke statement in query use the '*' wild card in the query ranges. Something like the following,
static void likeQuery()
{
Query query = new Query();
QueryRun queryRun;
;
query.addDataSource(tableNum(CustTable)).addRange(fieldNum(CustTable, AccountNum)).value('400*');
queryRun = new QueryRun(query);
if(queryRun.next()) {
purchTable = queryRun.get(tableNum(CustTable));
print custTable.AccountNum;
pause;
}
Tuesday, August 5, 2008
Dynamics AX Development Training Plan
Task No Task Description
1.Installing AX, AX 4.0 Development Mock 1
2.Morphx IT, Chapter 3 – Data Dictionary
3. Inside Dynamics AX , Chapter 12 – The Database Layer
4.Morphx IT, Chapter 5 – Classes
5.Inside Dynamics AX, Chapter 5 – The X++ programming language
6.Morphx IT, Chapter 6 – Forms
7.Morphx IT, Chapter 7 – Reports
8.Inside Dynamics AX, Chapter 6 – Customizing Microsoft Dynamics AX
9.Inside Dynamics AX, Chapter 7 – Extending Microsoft Dynamics AX
Tuesday, April 29, 2008
Hide an element from the combo box
I have an enum with values Element1, Element2 and Element3. Now this enum is being used on two different locations what the requirement is that i have to add another element Element4 in to the enum but this should only reflect on one location.
Answer
Let say you you two forms where this enum is reflected, namely Form1 and Form2. In order to hide an element from Form1 and continue showing it on Form2 go to form design and then access that combo box control. Override the enter() method of that combo box and write this line to delete the element from it.
combobox:enter()
{
super();
this.delete(enum2str(BaseEnum::Element4));
}
Friday, April 11, 2008
Change Type of a Control on the Runtime
Answer: Coming Soon!
Friday, April 4, 2008
Posting in the General Ledger (GL)
Question:
How to create a posting entry in General Ledger (GL) module of Dynamics AX?
Answer:
There are many ways to create posting entries in to General Ledger module. In my experience the simplest way is to use the Journal classes. There are two parts of posting create a heade entry and then create the add lines to it. To create a header entry use the LedgerJournalTable table and use the LedgerJournalTrans table. Finally use the ledgerJournalCheckPost class object to post these entries into the system.
Below is a job explaing the Posting process in a simple way.
{
Dialog dialog = new Dialog("Ledger Posting Example");
DialogField ledgerAccountField;
DialogField offsetAccountField;
DialogField ledgerJournalDescription;
DialogField ledgerAmount;
DialogField ledgerTransDescription;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberSeq;
;
dialog.addGroup("Post Ledger Voucher");
//Add Fields
ledgerAccountField = dialog.addField(typeid(LedgerAccount), "Ledger Account");
offsetAccountField = dialog.addField(typeid(LedgerAccount), "Offset Account");
ledgerJournalDescription = dialog.addField(typeid(Name), "Journal Name");
ledgerAmount = dialog.addField(typeid(AmountCurDebit), "Debit Amount");
ledgerTransDescription = dialog.addField(typeid(Name), "Transaction Text");
if(dialog.run())
{
ttsbegin;
//STEP1: INSERT Journal Header
ledgerJournalTable.JournalName = 'Day1'; /This is the journal name.
ledgerJournalTable.initFromLedgerJournalName();
ledgerJournalTable.Name = ledgerJournalDescription.value();
ledgerJournalTable.insert();
//STEP2: INSERT Journal Details
numberSeq = NumberSeq::newGetVoucherFromCode(LedgerJournalName::find(ledgerJournalTable.JournalName).VoucherSeries);
ledgerJournalTrans.Voucher = numberSeq.voucher();
ledgerJournalTrans.JournalNum = ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = CompanyInfo::standardCurrency();
ledgerJournalTrans.ExchRate = Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = ledgerAccountField.value();
ledgerJournalTrans.AmountCurDebit = ledgerAmount.value();
ledgerJournalTrans.TransDate = Today();
ledgerJournalTrans.OffsetAccount = offsetAccountField.value();
ledgerJournalTrans.Txt = ledgerTransDescription.value();
ledgerJournalTrans.insert();
//Post Journal into Ledger Accounts
ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
Info(StrFmt("Journal %1 is posted", ledgerJournalTable.JournalNum));
}
}
Monday, March 24, 2008
Create Custom Lookups Dynamics AX
Question:
How can we create customized lookups in Dynamics AX
Answer:
One way of creating a custom lookup is by using the power of SysQuery. Lets solve this using a scenario, we want to create a customized vendor lookup that will be used on the Item form. We will define a vendor type and an item type and the vendor that matches the item type on the purchase order form shall be displayed in the lookup. So in order to get this output we will create a method lookupVendor() in the Vendor table and we will call this method from the overridden lookup() method of the Vendor.VendorId field of Vendor datasource passing in the item type from the form.
New method created in the Vendor table
public client static void lookupVendor(FormStringControl _ctrl,
VehicleVendorType _vehicleVendorType)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(VehicleVendor), _ctrl);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange vehicleVendorFuelFilter;
;
sysTableLookup.addLookupfield(fieldnum(VehicleVendor, VendorId), true);
sysTableLookup.addLookupfield(fieldnum(VehicleVendor, VendorName));
qbds = query.addDataSource(tablenum(VehicleVendor));
switch (_vehicleVendorType)
{
case VehicleVendorType::Fuel:
qbds.addRange(fieldnum(VehicleVendor, IsFuelVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Mantienance:
qbds.addRange(fieldnum(VehicleVendor, IsMantenanceVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Manufacturer:
qbds.addRange(fieldnum(VehicleVendor, IsFuelVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Tyre:
qbds.addRange(fieldnum(VehicleVendor, IsManufacturer)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Vehicle:
qbds.addRange(fieldnum(VehicleVendor, IsVehicleVendor)).value(queryValue(NoYes::Yes));
break;
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Overridden method of Vendor.VendorId on Vendor Datasource
public void lookup(FormControl _formControl, str _filterStr)
{
;
VehicleVendor::lookupVendor(_formControl, VehicleVendorType::Fuel);
}