Friday, August 31, 2007

Overriding method for a control in dialog (RunBase framework)

Can we have an overridden method in a dialog class. I can not use form as a dialog. I have to add a method in the dialog class. Like modified method of an EDT.

Well it can be done. First you have to add a method dialogPostRun

public void dialogPostRun(DialogRunbase dialog)

This method actually allows the dialog form to override control method at runtime. Now we need the name of the control at runtine that needs the overriden method. You can get that using


where dialogCustId is the EDT. let say the name returned at runtime is Fld3_1.

Now if you have to override lookup method of the EDT you can write the method like this

void Fld3_1_lookup()
//override lookup method here

If you need to override modified method

boolean Fld3_1_modified()

The modified method can also be accessed by overriding

public void dialogSelectCtrl()

in the runbase class. Just call


in the dialog method.

You can also create a dialog form and pass it as the parameter in the dialog method of runbase class. you can find an example in tutorial_runbase class and form.

Tuesday, August 28, 2007

Get field label in X++

Scenario: I want to use the label of a field in code.

Answer: Use SysDictField class

SysDictField dict = new SysDictField(tableId, fieldId);
str label = dict.label();

Query on table

Scenario:Can I use query on table; give some examples on exisitng tables;

Answer: Yes you can use queries on axapta tables like any other code. You can have a look at the InventSum table newQuery() method.

Saturday, August 25, 2007

Dynamics AX Certification

Microsoft Dynamics AX 4.0 Development
Introduction Certification Exam (VUE Exam # AX 40-508,
Prometric Exam # MB6-508) Preparation Guide

Target Audience
Individuals wishing to obtain a certification on Microsoft Dynamics AX 4.0 Development Introduction should take this exam.

Exam Specifics Skills Being Measured:
This certification exam measures your ability to understand and use the integrated development environment of Microsoft Dynamics AX, MorphX Development Suite. You will be tested in the AX Architecture, Data Dictionary, user interfaces and Report adjustments. You will also be measured in how to use X++, Classes, Control statements, Data Base access and Exception Handling.

Time Requirements and Questions:
90 minutes to complete the exam
75 questions with a passing rate of 70%
Multiple Choice and Multiple Answer questions

Register for VUE Exam# AX 40-508 AX 4.0 Development Introduction Certification Exam at
Pearson VUE
Register for Prometric Exam# MB6-508 AX 4.0 Development Introduction Certification Exam
at Thompson Prometric

Exam Preparation Tools
In addition to your hands-on experience working with the product, we highly recommend using the
following tools and training to help you prepare for this exam:
Training Materials:
8623: Development I in Microsoft Dynamics AX 4.0
8633: Development II in Microsoft Dynamics AX 4.0
Instructor-Led Training (Please check with your region to verify instructor-led training
8623: Development I in Microsoft Dynamics AX 4.0
8633: Development II in Microsoft Dynamics AX 4.0
For training materials in additional languages visit Training Materials and search for additional languages.
For instructor-led training in additional languages please visit Find Training and search for courses in
additional languages.

Additional Skills Recommended:
Experience in object oriented programming

Exam Topics
General Microsoft AX Architecture – 18%
Understanding of 3-tier Architecture
Understanding of AOS
Knowledge of Layer Technology and how to Work with Them
Understanding of Label System and Creating Label Files
Development Tools - 18%
General Knowledge of AOT
How to use Intellimorph
How to Import/Export Objects
Debugging Techniquest
Application Objects– 21%
Creating Data Dictionary Objects
Creating and Working with Forms
Setting Up Projects
Creating and Working with Reports
Creating and Working with Queries
Creating and Working with Menus and Menu Items
Utilizing the Security Structure
Utilizing the Configuration Structure
Table Collections and Virtual Companies
X++ Development – 27%
Data Manipulation/Accessing the Database
Working with Maps
Interacting with the User
Working with Data Models
Working with Class Models
AX-specific Select Techniquest
Best Practices – 16%
Using Naming Conventions
General X++ Coding Standards
Using Validation Techniques

Display method in code

Scenario: Can i use display methods in X++ code. I mean if i have a display method getStatus() on table Vend. I can use it like vend.getStatus(). Is it a violation of best practice what are the pros and cons.

Answer: No, there is no performance penalty and no best practice warning is issued.
So you can go ahead and use the display methods in code.
The only difference from a non-display method is that you can actually use them in forms and reports.

Add as display method getStatus() in the CustTabl method list.

public display boolean getStatus()
return true;

Use this method in the field group and in the code simultaneously.

public void processCustomerStatus()
if (this.getStatus())
info("Consider status");

Friday, August 24, 2007

Getting number of recrods present in a query run

Scenario: I want to get the total number of records from a query run object. I will use them to generate a progress bar (progress indication framework).

Answer: Use SysQuery::countloop(qr). this will return the total number of records in a query object.

Thursday, August 23, 2007

Customized Form as Dialog Box

Scenario: I need to create a runbase dialog with saving options. I need to have a runbase calling a form present in AOT.

Override dialog method of runbase
public Object dialog()
FormRun dialogForm;
Args args = new Args(formstr(CustVendPaymProposalModPaymAttribDialog));

dialogForm = classfactory.formRunClass(args);

return dialogForm;

CustVendPaymProposalModPaymAttribDialog is the dialog form which was created in order to
facilitate the design.

Customized auto report dynamics ax

Scenario: Can we have auto reports in dynamics ax.

Answer: You can not have customized auto reports in dynamics ax.

Filtering and Sorting in display methods

Scenario: Can we have sorting and filtering in display methods?

Answer: You can not have sorting or filtering in display methods.

Wednesday, August 22, 2007

Calling validate write of other tables in for datasource


I am stuck in an issue. I did some changes on CustTable form. CustTable form is dependent on four datasources. I did some validation on CustTable Table and OrganizationDetail Table. Now the issue is when the form is saved the validateWrite() on only the focused datasource is called. Is it possible that the validateWrite() of the whole form is called. I mean of all the datasources associated with the form.


AFAIR, the system calls validateWrite only on the active datasource and on datasources that are joined with the active one.

So if your link type is active or delayed (not inner join, for example), then the validateWrite on such datasource won't get called. (it is a different query, after all).

well, you see. This is an impossible situation.

if your datasource is inner joined with CustTable, the validateWrite on this datasource would be called automatically.

So I gather that it is not inner joined. Which means that it's an active join (probably you have a separate grid or something showing data from this table).

And when you press Ctrl+S on the form, the validateWrite is called only on the active datasource.

so you have to write code on both validateMethods, making sure that the interconnected fields don't get wrong input. BUT you validate only data from the active dataSource.

So, if you save CustTable record, the custTable field is validated, and if it is a restricted combination, you say that this is the wrong value in CustTable, not in the related table.

And if you save the record in the related table, you validated only data on this table.

hope this makes sense to you

Accessing Parent Datasource

If you need access to the datasource() of the parent form. Parent form and child form being attached with dyna links you can use the following code snippet

element.args().record() to get the Datasource selected on the parent form.

For e.g. If you create a form named CustAdditions which is a child form to CustTable, and these two datasources are attached using dyna links and you want the selected CustTable record on child form you can write in the init method of CustAdditions

Code Snippet:
public void init()
CustTable custTable = element.args().record();