Monday, October 27, 2008

Microsoft Dynamics AX 4.0 data model overview

How to update the label and helptext of the RunBase OK and Cancel buttons

The code needs to be put after the super() call in the putToDialog() method.

protected void putToDialog()


FormBuildCommandButtonControl commandButton;



commandButton = dialog.dialogForm().control("OkButton");



Dynamics community

How to setup SSRS reporting

Wednesday, April 16, 2008

What are ADO files

What are ADO files ?

ADO stands for Application Data Object and holds the application code for a
layer. You have an ADO file for each layer you have modified in your system.
Per defaul it is locaed in C:\program files\Microsoft Dynamics
AX\40\Application\Standard . There will be at least a axSYS.aod and an
axSYP.aod . Where the axSYS.aod is the SYS layer and axSYP.aod the SYS-Patch
(SYP) layer.

Monday, March 31, 2008

Dynamic languages

Dynamic languages are one of the most interesting fields in programming, because it gives the developer more functionality & flexibility in developing applications.

The reasons of this are
The ability to modify the code in runtime, which saves the time of compiling, linking and building the application.You can imagine editing the code that runs on a robot walking on Mars from earth, this actually happened in NASA using LISP, and imagine how difficult this can be if you were using compiled languages.

Usually the dynamic language codes are less complicated than static language codes.
Usually dynamic languages support both Object Oriented and Functional Oriented models of programming.

Portability level is always higher in interpreted languages

Dynamic language syntax is usually easier and shorter if compared with equivalent codes in other compiled language

Monday, February 11, 2008

How to run AX after changing the network domain

Question : I have a system with a clean installation of AX , after I change the domain I am not able to run AX. So i have to reinstall the AX.

Answer :I solved it by editing the UserInfo table, replacing theNetwork user, Network domain and SID fields with values from a user in thenew domain.

Monday, September 10, 2007

Question :
When using index (not using hint) in a select statement without 'GroupBy' or
'OrderBy' in what sequence do the records occur

When using Index hint, the index chosen is hinted to the SQL server as the
one that should be used for the query.
(you shouldn't use this unless you are very sure that's the best selective
index there ever will be for the table)

the index (without hint) is interpreted into a simple ORDER BY clause, so
the records will be ordered in the order of the fields from the index.

( you can turn on logging SQL statements and see the actual query being sent
to the server)

Why to call update

This does not updates the table
AssetParameters asset;
asset =AssetParameters::find(true);
the following code updates the table now the question why there is need
of call asset.update(); ------------------------------------------------------------------------------------------------
AssetParameters asset;
asset =AssetParameters::find(true);

AX works with cursors
In code snippet , asset - is a cursor - a special object storing the values of a record of a specific table, in your case, the AssetParameters table. Which means that you can modify any fields in this cursor, but they won't get reflected in the database, because it's NOT the database, it's just a
storage for the values you input. The update method, if properly called (notice the ttsbegin and commit and the true parameter in the find method), will transfer the changes in the
cursor into the database.DAX kernel makes the analysis and extra manipulations with the data when
super() of this method on table level is called.For example, it can set the modifiedBy and other modified* fields on the record, if the corresponding properties are turned on on the table.
Also, it analyzes the fields that have been changed and creates the query,needed for the update, assigns a new RecVersion, validates that no other users have changed the record while you were making your changes (here concurrency models are analyzed as well), etc...

More RecId and Id

A RecId is a unique identifier for any record in:
a table (for DAX 4.0)
the entire company (DAX 3.0 and earlier)

RecId is assigned to every record by the kernel of Dynamics AX each time a
record is created.

an ID is not a standard name in DAX, so it's either a customized field added
into the table you are looking into, or just an identifier of an object.

For example, there is a TABLE ID, which is the number of each table in DAX.
A FIELD ID is an integer identifing a field in a table.


You can make your IDs string as well, for example the NumberSequences work
this way.

Dynamics AX Certification

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

What is the difference between a RecId and an Id?

1. What is the difference between a RecId and an Id?

Ans. The kernel generates the RecId while the Id is generated by the

Sunday, September 9, 2007

Extended datatype of a variable

how can I determine the extended datatype of a variable dynamically?
I know the function typeof(), but that gives me only the underlying basic-type through the enum Types. That's not enough for my purpose.

static void printType(Args _args)
DictType dictType;

print "This ID is the TypeId, not the EDT ID - ", typeId(ItemId);
print "This ID is what we need - ", typeId2ExtendedTypeId(typeId(ItemId));
print "This ID is wrong - ", new DictType(typeId(ItemId)).id();
dictType = new DictType(typeId2ExtendedTypeId(typeId(ItemId)));
print "This ID is correct - ",;

dynalink info in caption of forms

When opening a form with a dynalink to some record, this dynalink information
is automatically added to the form caption, often making the caption very
long and hard to read. Example: Open the SalesTable form from a debtor

Answer 1.
you can add this line befor super() call in init() method of the form.


Answer 2.
You can override the active method on the datasource and add the
following line there:"%1", smth));

Saturday, September 8, 2007

Time difference b/w insert_recordset and update_recordset

Prerequisite to run this Job is to create a new table of the name TestTable having a field CustName which extends from CustName EDT.

Here i am trying to find what time is takes to insert and update records using insert_recordset and update_recordset.When the Table's Temporaryproperty is YES and No.

With Temporary property set to No.update takes half of the time it takes to insert.

With Temporary property set to Yes.update and insert operations take zero time.

TestTable test;
CustTable Cust;
int time1;
int time2;

time1 = WinAPI::getTickCount();
insert_recordset test(CustName)
select Name from Cust;
info(strfmt('Insert Time %1 %2',time2,time1));
time1 = WinAPI::getTickCount();
update_recordset test
setting CustName='Huzaifa';
info(strfmt('Update Time %1 %2',time2,time1));
while select * from test


Wednesday, August 8, 2007

Caching of display methods

Caching of display methods has been introduced to improve the performance of display and edit functions if they are calculated on the AOS, and to improve the performance when records are transferred from the server to the client.

Signing up methods for caching

Only methods that are explicitly added to the cache are affected by the new caching mechanism. To sign up a method for caching, the method cacheAddMethod on the form datasource should be called after super() in the init method of the datasource.

The call to cacheAddMethod also determines how often the cached display method value is updated. The value is filled in on fetching data from the back-end, and it is refreshed when reread is called on the datasource. Furthermore, by default the display method values are also updated when the record is written to the database, but that can be changed using the _updateOnWrite parameter in the cacheAddMethod.

Only display methods that are of display type can be cached, i.e. edit-methods cannot be cached

The cacheAddMethod signs up the specified display method for caching. The cached methods are calculated on fetching data, and the calculated values are then passed to the client together with the data. The cached values are refreshed on reread, and by default, on write and create.


public boolean cacheAddMethod(str _methodName, boolean _updateOnWrite)


Returns: TRUE if the method was signed up successfully, otherwise FALSE

_updateOnWrite: Determines whether the cached value is updated automatically when the record is written. Default value is TRUE.

This method should be called after initialization of the datasource, but before any data is fetched. Hence the call to this method should be placed after the call to super() in the init method.

The _updateOnWrite parameter also determines if the display method value should be calculated and cached when a new record is created. To manually update the cached value for the display method, call the cacheCalculateMethod method.

Only methods with the display keyword can be cached. Furthermore, only table methods can be cached, i.e. methods written on the form or the form datasource cannot be cached. Use the tableMethodStr function to get a compile check as to whether the method exists.

Do not sign up display methods that are not used on the form - they will be calculated for each record even though the values are never shown.

Example 1

public void Init()





On a form having custtable as a datasource, you might find this in the init method of the datasource

how to make look up

The super() call in Lookup checks whether the control is bound to a field, or to an Extended Data Type and calls either




which are both member functions (methods) on the Formcontrolname class (FormStringControl, FormRealControl, FormIntControl, FormDateControl or FormTimeControl).

You can override the super() call, and call one or the other method yourself, and give the necessary parameters.

One possibility is to call performDBLookup with only FieldId, in which case you can perform a lookup on another field within the same data source.

void Lookup()


FormStringControl FEL;

FEL =;

//12 is the Id for the field to be shown on the Country control



Both methods may also be called with an alternative Company to achieve a lookup in another data file. Default company is the one that the current data source belongs to.

Sample Code

public void lookup()
Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

// Create an instance of SysTableLookup where 'this' the current Form control.

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LedgerJournalName), this);


// The field to be shown in the lookup form.

sysTableLookup.addLookupField(fieldNum(LedgerJournalName, JournalName));

// Limit and arrange data selection.

queryBuildDataSource = query.addDataSource(tableNum(LedgerJournalName));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(LedgerJournalName, JournalName));


// Perform lookup



Monday, July 30, 2007

number sequence is created under

From a developers point of view, these are the tables which are important.

• NumberSequenceTable contains the definitions of each number sequence.
• NumberSequenceList holds numbers for continuous number sequences that have not been completed or are currently reserved.
• NumberSequenceReference holds which number sequence is used for which function.
• NumberSequenceGroup is a list of number sequence groups.
• NumberSequenceGroupRef contains the number sequence references specific to a group.
• NumberSequenceTTS holds the transaction id of a number before it has been completely assigned. It is used during the clean up process, in case of a system crash.
• NumberSequenceHistory holds a log of all changes made to the number sequence.

From a developers point of view, these are the classes which are important.

• NumberSeq assigns numbers and vouchers, handles continuous number sequences, and calls clean up when appropriate.
• NumberSeq_Fast is used for number sequences that are not continuous. It does not keep a record of the status or store transaction ids for later clean up, and is better performance wise.
• NumberSeqCleanUp looks for numbers in the list that have not been completed, looks for the session that created them, and, if the session is no longer active, frees up the number for later use.
• NumberSeqDataArea is used in the clean up process.
• NumberSeqFormHandler is used whenever a number sequence assigns a number in a form. It handles records being deleted and ensures that two users cannot use the same number.
• NumberSeqReference creates the link between the function and the number sequence. NumberSeqReference is the super class used, and there is a sub class for each module.
• NumberSeqNumCache contains the method to manipulate the cache of reserved numbers.

Saturday, July 28, 2007

Bussiness Model of MS GP

Sate Design Pattern

Every developer has implemented a finite state machine at least once in his or her career. You can't avoid them—they are everywhere, and not just limited to the world of software development.The ability to add more states to the design of a finite automaton is often an unwritten requirement, and implementations are frequently modified when requests for additional states and transitions arrive. If you've got a good design, you can anticipate and account for such changes. More importantly, behavior and operations specific to any state in a finite state machine should be confined and localized to the representation of that state. In other words, state-specific code lives in an object that implements that state. This, in turn, allows you to add new states and transitions easily

namespace State_Pattern
public abstract class State
public abstract void Handle(Context context);


public class Context
State state;

public State State
get { return state; }
set { state = value; }
public Context()
this.state = new ConcreteStateA();


public void Handle()


public class ConcreteStateA:State

public override void Handle(Context context)

Console.WriteLine("i am in Concrete A" );
context.State = new ConcreteStateB();

public class ConcreteStateB : State
public override void Handle(Context context)
Console.WriteLine("i am in Concrete B" );
context.State = new ConcreteStateA();

class Program
static void Main(string[] args)
Context context = new Context();
for(int a =0 ; a<10;a++)


Wednesday, July 25, 2007

customizing Editor scripts

They have lots of useful scripts which are really very useful for the developer. You can also customize these editor scripts and add your own scripts. What you have to do is edit the EditorScripts Class (\Classes\EditorScripts) with your new script.
As a practice whenever me or my colleagues create a new Class/Form/Report in AX, we add a new method called DevelopmentHistory() which contains details on all modifications made to that object by any developer. It later becomes easy to view changes made and identify why they were made :).

Hence I added this method in the class:)


void comments_DevelopmentHistory(Editor e)
e.insertLines('void DevelopmentHistory()'+'\n');
e.insertLines('Made By :'+'\n');
e.insertLines('Date :'+'\n');
e.insertLines('Project Ref :'+'\n');
e.insertLines('Brief Functionality :'+'\n');
e.insertLines('Changes Made :'+'\n'+'\n'+'\n');


Tuesday, July 24, 2007

Huzaifa Gain


Friday, July 20, 2007

What is RecId

The RecId is a unique field in every table, used as an identifier. Every row in the system can be guaranteed (in theory) to have a unique RecId. RecIds can be negative, and their value can change due import/export operations. Due to this, it is not a good idea to use RecIds as foreign key references to other tables.

Share Point FAQ

Q: What is Windows Sharepoint (WSS)?
Ans: Windows sharepoint is new technology, which is available in the form of service on Windows 2003 server. It uses CAML (Collaboration application markup language) Wss is more content management based with document libraries and lists.

Q: What is Share Point Portal?
Ans: Windows share point portal offering features like global navigation and searching.

Q: What is document library?
Ans: A document library is where you upload your documents, they consists of row and columns with links to the documents

Q: What is meeting workspace?
Ans: Documents workspace consists of information surrounding a single or multiple documents.

Q: What is a web part?
Ans: Web parts are nothing but the integrated controls which perform some specific task. In short web part is nothing but xml queries to full sharepoint list or document.

Q: What is web part zone?
Ans: Web part zone consist of zonetemplate, and it is nothing but a container in which we can drag and drop user control.

Q: What is DWP?
Ans: DWP is nothing but name of web part file extension

Q: What are various kinds of roles user can have?
Ans: 1. Reader: Has read only access to the web parts
2. Contributer: Can add content to existing document libraries and lists.
3. Web Designer: Can add content to the existing document libraries and lists
4. Administrator: Has full control of the web site

Event Method Sequences when a Form is Opened

AX Web Form Control Properties

LookupMethod:Specifies the behavior for a lookup button on the form. The default behavior is to display a pop-up window.

LookupControl:Creates a custom lookup with a relation between two table fields.
Set the LookupControl property to the name of the relating field, and the LookupMethod property to Custom.

MenuItemName:This property is not supported in Microsoft Dynamics AX.

MenuItemType:This property is not supported in Microsoft Dynamics AX.

ServerSideControl:Specifies whether tab changes are handled on the server or the client. Set the property to Yes for the server. Set the property to No for the client.

WebMenuItemName:Specifies the name of the menu item.The menu items in the property list vary depending on the setting of the WebMenuItemType property.

WebMenuItemType:Specifies whether the menu item is a URL link to a Web part page or an action that references a class or job.

Difference b/w Abstract class and Interfaces(C#)

.An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods.

·An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the property's signature but no implementation.

·An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class.

·A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class.

·Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.
·Abstract classes are faster than interfaces.

Wednesday, July 18, 2007

Enterprise Portal 4.0 Architecture

Install of AX Enterprise Portal

EP Installation with WSS 3

I have decided to install Enterprise portal once again, because I received several strange errors in event viewer. Now I'm gonna write down every step I take including fixes from the internet.

I use "Install and configure a Microsoft Dynamics AX Enterprise Portal Server" -white paper as a main source. This version is dated in February, 2007. Another tool I use is a memo downloaded from Microsoft Technet: "Deploy in a simple server farm (Windows SharePoint Sservices)" I can't make basic installation bacause our Database is located in another server. So we need a server farm.

So let's begin. I have uninstalled IIS and SharePoint including all the related databases.

Installed or created prerequisites:

- Dynamics AX client

- Business connector proxy in AD

- SQL Server 2005(Security & Login settings)

1. Install IIS (, Frontpage not selected)

2. Enable ASP.NET 2.0 (\Windows\\Framework\v2.0.50727)

3. Copy Ax32.exe.config to the \Client\Bin -folder

4. Install .NET Framework 3

5. Install WSS 3

5.1 Choose Installation: Advanced

5.2 Server type: Web Front End - Install

5.3 "Run the Share...." -check box selected - Close

5.4 Configuration Wizard

5.4.1 "No, I want to create a new server farm" Next

5.4.2 Database server and database name, User name (proxy user) & psw

5.4.3 Specify Port number - empty, NTLM - next, next, Finish

5.5 IE: tools, internet options, trusted sites - add

Create new web application

5.6 Central Administrator page: Application management/SharePoint Web application management/Create or extend...

5.7 Click "Create a new web application"

5.8 Create a new IIS web site: "Sharepoint - 80", Allow anonymous - Yes, Create a new application pool: "Sharepoint - 80", Configurable: User name: (proxyuser), psw - Others default

5.9 "Iisreset /no force" in command prompt

5.10 Operations-tab/ Security Configuration/service accounts: Web Service: Choose "Windows Sharepoint..."

5.11 In Application pool, select "Sharepoint - 80"

5.12 Select configurable. User name: (domain\proxyuser), OK, "iisreset /noforce"

6. Configure ASP.NET (web.config-file) and "iisreset /noforce"

7. Add Proxy-user to the groups: Power users, IIS_WPG, WSS_WPG

8. Configure IIS for SharePoint and EP:

8.1 Open IIS manager. Right click Web sites. Choose properties

8.2 Directory security/Authentication and access control, edit: Integrated Windows authentication - OK

8.3 Expand Application pools. Choose Sharepoint - 80 and properties. Check that Proxy-user is in configurable in Identity-tab.

8.4 Expand Web sites. Choose Sharepoint - 80 and properties. Check that version v2.0... is selected in tab. Check also Sharepoint central Admin v3 -site.

9. Install EP. Choose Enterprise portal server in Select computer role page.

10. Open AX client and run EP Configuration wizard if not already done (I had earlier installation)

11. Complete Manage deployment wizard. I got error:"Cannot create Performance Category 'Microsoft Dynamics: Enterprise Portal' because it already exists." This might be because of earlier installation so I don't mind this.

12. Create EP site

12.1 In Client menu...EP/Web sites. Click Create site. Create a site collection-page opens

12.2 Fill in needed info. In template selection: Choose custom and Dynamics public

12.3 Primary & secondary administrators I chose myself and Proxy-user. Ok.

12.4 Top level site successfully created. Copy the url and click OK.

12.5 In AX-client/Web sites click Register site.

12.6 Paste the url. Type is Full, Anonymous=true and Press CTRL+S to save changes. Click View in Browser.

12.7 Delete the site from the AX when Register site-page opens in browser.

12.8 Choose the company. Click Register.

12.9 If everything goes fine the installation is completed. Now I have to add the user relations settings.