Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.
This article is intended primarily for intermediate Microsoft Dynamics AX users who are familiar with X++ andMorphX. The Goal of this article is to help the users by providing the tips and enhancements in the Dynamics AX.
Microsoft Dynamics AX (formerly Axapta) is one among the Microsoft Dynamics ERP primary products. Microsoft has a range of products under the Microsoft Dynamics umbrella (like Navision, Axapta, Great Plains, Solomon, Concorde, Point of Sale, Retail Management System, Customer Relationship Management and etc) that are more applicable for the small, medium and larger business organizations. X++ is the language used to built Dynamics AX. MorphX is an integrated development environment in Microsoft Dynamics AX that allows developers to graphically design the GUI. MorphX allows access to application classes that are available in the application, by launching the X++ code editor. Microsoft Dynamics AX provides a set of Web sites that give you access to data through web forms which are collectively deployed and accessed from Microsoft SharePoint Enterprise Portal. The development could also be done using Visual Studio.Net.
X++ is an Object Oriented Programming language, also called OOP language. A class is a collection of methods. And subclasses are classes that inherit from other classes by using the keyword extend. In X++, a new class can only extend one other class, multiple inheritance is not supported. If you extend a class, it inherits all the methods and variables in the parent class (superclass).Subclasses enable you to reuse existing code for a more specific purpose, saving time on design, development, and testing. To customize the behavior of the superclass, override the methods in your subclass.
Static modifiers are often used in classes for methods which need to be accessed frequently.
Final Modifier will prevent the class to be overridden. A final modifier on the method similarly cannot be overridden by a subclass.
Abstract Modifier is exactly opposite to Final modifier. The use of abstract classes is a way to force inheritance to make the sub classes use the base class. It prevent the class being declared using new(). An abstract method must be overridden as an abstract method and cannot have a code block. Abstract methods cannot be static. Display and Edit Modifiers : Usually these modifiers are not present in other languages, they just belong to X++. These modifiers are used in Forms and Reports to edit and display data in the user interface. For more information refer online documentation here http://msdn.microsoft.com/en-us/library/aa595058.aspx
Dynamics AX consists of sixteen application object layers that contain all the elements in the AOT.
Here are descriptions of the application object layers in Microsoft Dynamics AX 2009:
USR – User – Individual companies or companies within an enterprise can use this layer to make customizations unique to customer installations.
CUS – Customer – Companies and business partners can modify their installations and add the generic company-specific modifications to this layer.
VAR – Value-Added Reseller - Business partners use this layer, which has no business restrictions, to add any development done for their customers.
BUS – Business solution - Business partners develop and distribute vertical and horizontal solutions to other partners and customers.
SL1-SL2-SL3 – Certified solutions – Partners certified under the Microsoft Dynamics Industry Solution (MDIS) program distribute their solutions in the SL layers.
HFX – Hotfix – The Dynamics AX team delivers critical hotfixes using the HFX layer.
GLS – Global solution – The Dynamics AX Global Development and Localization team provides a set of GLS layers that contain country-specific functionality for regions in which Dynamics AX is released.
SYS – System – This is the lowest model element layer and the location of the standard Dynamics AX application. Only Microsoft has access to the element definitions at this layer.
The layer-based application object files (AOD files), Some of them have been renamed with a new prefix in different versions of Microsoft Dynamics AX as shown below in the following image.
The four layers DIS / DIP / LOS / LOP from Microsoft Dynamics AX 4.0 have been renamed to HFX / SL1 / SL2 / SL3 in Microsoft Dynamics AX 2009.
The six layers DIS / DIP / LOS / LOP / BUS / BUP from Microsoft Dynamics AX 4.0 have to be renamed to FPK / FPP /SLN / SLP / ISV / ISP in Microsoft Dynamics AX 2012.
AX 4.0 Layer
AX 2009 Layer
AX 2012 Layer
The six layers HFX / SL1 / SL2 / SL3 / BUS / BUP from Microsoft Dynamics AX 2009 have to be renamed to FPK/ FPP / SLN / SLP / ISV / ISP in Microsoft Dynamics AX 2012.
There are some functions which have been separated to another modules. Below are the few comparisons to show the new modules added in MicrosoftDynamicsAX 2012.
AX 2009 Modules
AX 2012 Modules
Fixed Assets (New)
Cash and bank management
Procurement and sourcing (New)
Sales and Marketing (New)
Product information (New)
Inventory and warehouse management
Travel and expense management
Project management and accounting
Compliance and internal control (New)
The user interface in Microsoft Dynamics AX 2012 has been changed to be simpler and user friendly at all levels.
Fix for adding a new dimension in Dynamics AX
A very minor fix is required on the following SysDimensionAddWizard class to enhance the dimension functionality in Dynamics AX 4.0 and Dynamics AX 2009. This fix is not required for Dynamics AX 2012. SysDimensionAddWizard class which runs the Financial Dimension Wizard, it is used for adding a new financial dimension to the system. Number of adding dimensions are controlled by Dynamics AX License key. Make sure you have sufficient licenses for the number of dimensions you are adding to Dynamics AX 2009, Since user defined dimensions are limited to seven.
Standard AX comes with the following three default dimensions:
In SysDimensionAddWizard class changes are required in its run() and versionControlCheckOut() methods.
Add the code to run() method under the if statement as shown in the below image.
Add the code to the versionControlCheckOut() method as shown in the below image.
After adding the above code, test by adding the dimensions. Note: There's no limitation on creating user defined dimensions, if you are using Dynamics AX 2012 ,the above fix and code changes are not required.
Data Consistency Check Framework in Dynamics AX 2009
The consistency check framework consists of classes with names ending in"ConsistencyCheck."
The consistency check in Dynamics AX validates only the predefined list of tables for each module. This ConsistencyCheck framework is heart of Dynamics AX. Unfortunately there is no much documentation available online on these topics. The intention is to provide some basic details about these classes.
SysConsistencyCheck Class is the base class which is extended by several classes in different modules. All the classes which are extending it override the run method. In which they specify the relevant table names related to the modules, they are checked by the kernelCheckTable or kernelCheckRecords methods. For more information on theSysConsistencyCheck class and its methods refer online documentation at the following link athttp://msdn.microsoft.com/en-us/library/aa674688(v=ax.50).aspx
To run the Consistency check go to Basic > Periodic > Consistency check
SysConsistencyCheckJob Class which helps in running and scheduling the Consistency check batch jobs.
The following are ConsistencyCheckclasses from Dynamics AX 2009which gives information about the class hierarchy and the configurations to which they belong.
These are the ConsistencyCheck frame work classes for different modules in Dynamics AX 2009 being covered in the above list.
To know more information on the configurations to which they belong visit this link here.
Minor fix in the below class
LedgerConsistencyCheck class is responsible for validating the General ledger module. LedgerConsistencyCheck class checks these following tables in the run() method. List of Tables
Add the AssetLedgerAccounts table to the LedgerConsistencyCheck class at end of its run() method as shown in the below image. The accounts for Fixed Assets in chart of Accounts hold references to the data in 'fixed assets in posting profiles'. By including the above table in the class will help to check and improve the data consistency.
The LedgerConsistencyCheck class should look like the above image in AX 2009. Note : This above fix is not required in Dynamics AX 2012.
Execute Stored Procedure from X++ code
To execute a stored procedure from X++ use the Server method, the Client method does not have permissions. Following is the screen shot of the code from Server method. you don't require any special privileges or permissions to execute a stored procedure. if used other then Server method, a message should appear like this 'Request for the permission of type 'SqlStatementExecutePermission' failed.'
create a job and write the above code as shown in the image.
When creating a table from AOT in Dynamics AX, developers often forget to right click and save the table, specially the developers habituated to SQL Server. There could be column names conflict if not saved in AOT and eventually the changes might be lost and cause other problems.
Note : If creating a table from AOT in Dynamics AX then there will be couple of default columns added to your table like RECID, RECVERSION, DATAAREAID and etc. Make sure to include and insert values into those fields.
Execute external database Stored Procedure from X++ code using ODBC connectivity
This is to show a method to execute external database stored procedures from X++ code. Create a job in AOT with following code. Follow the steps as explained here in the code like replace Server Name, Database name , Stored Procedure name. The below code is executed through the ODBC Connection.
staticvoid execExternalDatabase(Args _args)
loginProperty = new LoginProperty();
loginProperty.setServer("SERVERNAME Here"); // Replace your Database Server Name here
loginProperty.setDatabase("DemoDB"); //Replace your Database name here
odbcConnection = new ODBCConnection(loginProperty); // setting odbc connection here.
// ODBC Connection to create Statement
statement = odbcConnection.createStatement();
// Replace the StoredProcedure you want to execute.
sql = strfmt('EXEC [myStoredProcedureName]');
// Set code access permission to Execute
perm = new SqlStatementExecutePermission(sql);
// if Stored Procedure has Select query use executeQuery method.
resultSet = statement.executeQuery(sql);
resultSetMetaData = resultSet.getMetaData();
for (counter=1; counter <= resultSetMetaData.getColumnCount(); counter++)
print "An error occured in the query.";
// Code access permission scope ends here.
Used a simple select query in the stored procedure and the result will be displayed on the infolog.
Changing the Object IDs
While exporting/importing the .XPO file from DEV to another environment like QA, the object ID's might some times clash in dynamics AX. Then it prompts a message like this object ID is already used and throws an error in the infolog. It doesn't import some of the Objects. The following is the sample provided to show errors and warnings while importing tables.
The Objects like (tables, and Classes) when created, Dynamics AX automatically assigns a ID to each object. Users do think that ID's cannot be changed, but that also can be changed by editing the .XPO file and use find &replace-all so that the existing ID number will be replaced with new ID number in all the places where ever the references are used. It basically changes the ID and UTILOBJECTID in the XPO file. The manual process could some times cause problems. The best way is let Dynamics Ax handle it.
While Importing the XPO files, uncheck the 'Import with ID values' and Select the 'Enable data recovery for tables with changed IDs' under the options as shown in the above image. Dynamics AX automatically assigns the new ID's. It automatically syncs the objects. This process makes easy when importing multiple XPO files related to a project. Rarely you might end up some times with warnings and that could be resolved by investigating.
Using .NET framework directly in X++
This facilitates the developers having knowledge of the .Net Framework. They could use them directly in X++ to enhance the custom features in Dynamics AX.
staticvoid main(Args args)
// System.DateTime is from .Net Framework
// This is a sample to show how the Framework can be used along with X++ coding.
now = System.DateTime::get_Now();
getDateStr = now.ToString();
info("It is now : "+getDateStr);
Developers could also develop and use the custom DLL's designed in Visual Studio 2008. In order to use the Custom DLL, it should be copied to the Dynamics AX installation path 'Client\Bin' folder. Adding references in Dynamics AX to those custom DLL's you can start using them in X++. The default path of deploying the new .Net DLL is as follows
[DRIVE]:\Program Files\Microsoft Dynamics AX\50\Client\Bin
Note : Dynamics AX 2012 only supports the higher version Visual Studio 2010 and .Net Framework 4.0.
SystemSequences in Dynamics AX help to assign different set of numbers to RECID on every table.
There are several methods of migrating data in Dynamics AX. I noticed some issues with the memory, performance and troubleshooting, as typically the memory is managed in Dynamics AX by Kernel (windows system dll).
There are migration tools which also assist in migrating, no doubt they are awesome. But the developers can still migrate data with out using any third party tools. This could be achieved by just using SSIS 2005/2008. This is a very powerful ETL tool which microsoft has already provided. The developers should only know few tricks to handle RECID's and then it is easy to pull data from any Source database and migrate to the Dynamics AX destination database. The developers need to create and sync the RECID number of a table with the NEXTVAL from SystemSequences.
Below is the sample T-SQL code to know the next RECID number for a particular table. The ID of a table can be identified from the table properties.
--The below TSQL code will help to know the next RECID number for a Particular table.
DECLARE @TableIdNumber varchar(150)
SET @TableIdNumber = 1-- This ID Number belongs to [Address] table and is provided as a sample.
SelectConvert(Varchar(50),NextVal) NextRecID from SystemSequences where name = 'SeqNo'and tabid = @TableIdNumber
There are few list of ID's provided in the above excel sheet. Test the above code in SQL Server. Note : Dynamics AX 2012 only supports SQL Server 2008.
These following tables are very important since these are not specific for one module. The entire Dynamics AX depends on these tables and they are used in every module. VendGroup table contains definitions of all Vendor Groups. VendTable table contains vendors information for accounts payable. CustGroup table contains definitions of all Customer Groups. CustTable table contains the list of customers for accounts receivable and customer relationship management. DirPartyTable contains all Address of Customers , Vendors and etc, this is also know as Global address book.
The table DirPartyTable contains all the entries in the Global address book. The Global address book stores all the persons and organizations information which are used through out the system.
Proxies are created and generated to call X++ classes and methods in Enterprise Portal.This feature facilitates in providing the X++ code resources available for use in the Visual Studio web application project. There are some predefined proxies available for Enterprise Portal.
The proxies can be found at the root of the development website. (ex. [Drive]:\ Intepub\wwwroot\wss\VirtualDirectories\80\App_code\Proxies\ )
In AOT under the node [Web]-[Web Files]-[Static Files]-[Proxies] you can view all the proxies.
To provide access to the Class mention the class and method names in the editor as shown above. And below is a example provided.
/ Class:[SampleClassName] /[method:MethodName]
After adding it you need to generate proxies, now go to [Tools]-[Web Development]-[Proxies] and Click on Generate Proxies. you will now see new class is added to the Proxies node and a class added to the root directory.
To use the proxy class in C# following Assembly is used
The tracing provides the user to identify the time consuming SQL Queries, transactions and different code that executes on AOS. The performance could be measured and unnecessary load and process can be identified and avoidable.
RPC round-trips to server :This lets user to trace all RPC round-trips from client to the server. X++ method : The calls traces all X++ methods that are invoked on the server. Number of nested calls : Limits tracing to the specified number of nested method calls. Function calls : Lets the user to trace all function calls that are invoked on the server. SQL statements : Lets the user to trace all SQL Server statements that are invoked on the server. Bind variables : Lets the user to trace all columns that are used as input bind variables. Row fetch : Lets the user to trace all rows that are fetched using SQL Server Row fetch summary (count and time) : Counts all rows that are fetched, and records the time spent fetching Connect and disconnect : This option traces each time the AOS connects and disconnects from the database Transactions: ttsBegin, ttsCommit, ttsAbort This option lets to trace all transactions that use the TTSBegin, TTSCommit, and TTSAbort statements
The code profiler is used to calculate the X++ code execution time and the database activity time. When you start a Profiler and stop after execution, the information is stored in the database with the RunID. When you click on the Profiler runs, it will show all the RunID's and the tasks which were executed.
To avoid unnecessary disturbance of several tasks and want to use it for just a special task, you could use the following code. To execute this sample code change the Table Name and Column Name.
// This is a sample to show how to use code profiler for a specific user task.
staticvoid execCodeProfiler(Args _args)
// replace YourTableName with Original Table Name
// profile start point.
#profileBegin("Test of profiler")
while select tableName
// replace ColumnName with the Orginal Column Name
info(strFmt("Table name: %1", tableName.ColumnName));
if (counter >= 10)
// profile stop point.
Now you can see the Run ID and other information in Profiler runs screen, basically this type of scenario is used when checking the performance of the object by running several times and checking the duration result.
Kerberos is a network authentication protocol. Without Kerberos authentication being set up, SSAS reports and SSRS reports will fail to load in the Enterprise Portal.
To verify Kerberos authentication is properly set up use the following command.
setspn –L <account name>
To verify the HTTP service properly configured use the following command
setspn –L domain\bcproxy
If the results point to the correct server, then the SPN was configured correctly for the HTTP service.
In all the .odc files, the following value has to be present.
Note : Kerberos authentication has been deprecated in Dynamics AX 2012.
The problems on share point could be attended when you know what kind of error is throwing up. usually the messages are turned off, not to display it to the end user.
To check the log files which are located under the following path for SharePoint 2007.
[DRIVE]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS
The above image is sample from SharePoint 2007 when a error occur.
The log files are located under the following path for SharePoint 2010.
[DRIVE]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
The above image is sample from SharePoint 2010 when a error occur.
Steps to show up the Error messages right on the web page.
Open the web.config for the appropriate web application located under '[DRIVE]:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config' and change the following values.
After setting the changes reset IIS to reflect the changes done. Now you should see the error messages right on the web page. It will be easy to fix the problem after identifying it.
After fixing the problem change the above value settings back.
Using the Microsoft Visual Studio we could run stress and performance tests on Dynamics AX, there's a load test software available which is known as Application Benchmarking Toolkitfor Microsoft Dynamics AX. There are several scenarios available along with sample test cases. The source code is completely developed using C#.
The above image is a sample to show different scenarios from Visual Studio 2008 Solution explorer. The Load Test Software could be downloaded from the following site, certain parameters are required to setup and run it.http://benchmarktoolkit.codeplex.com/
Problem solving in Dynamics AX – A quick check-list
Sometimes, when developing, AX doesn’t work as expected, or behaves weird.
Here are some of the things you can try if you run out of ideas, below are some of steps. Try to Reproduce: You probably already did, but make sure you can reproduce the problem. If it only occurred once, it’s not a problem. Check your code again:Check your code carefully for errors, and maybe ask a colleague’s opinion. Compile : Your project might contain compile errors, so compile it to be sure. Close the debugger: Sometimes, when the debugger is active, AX will keep executing ‘old’ code. Close the debugger to make sure the latest code is executing. Compile forward :When you have modified a class that is inherited by other classes, you might want to compile forward this class. Synchronize data dictionary : You may have made changes to application objects that haven’t been synchronized with the database. Open the AOT, right click on the Data Dictionary node and choose Synchronize. Restart AX client : Simple as that, close the AX client and start it again. Reset usage data : Go to options screen (AX button > Extra > Options) and click the Usage Data button. Click reset to remove this data. Check the application event log for clues : Open the event viewer on the AOS to see if the AOS service has logged something in it. Messages here can help you a great deal. You can also check the event log on the database server or your client pc. Use Internet Search Engine : If you receive an error, just copy and paste it in Internet Search engine. Most likely you are not the only one having that problem. Check your AX client version: You might for example be connecting to a SP1 application with an SP0 client. You can check this in the about screen: AX button > Help > About. The kernel version indicates the client version, below that is the application version. Refresh AOD, Dictionary and Data : You can flush cashed information using three option in the Tools > Development tools menu: refresh AOD, refresh Dictionary and refresh Data. This can be useful when you just imported an xpo file, or when you are developing for the enterprise portal. Delete AUC file : The application Unicode object cache file, if there is one, is located at [DRIVE]:\Documents and Settings\[USERNAME]\Local Settings\Application Data for xp, or [DRIVE]:\Users\USERNAME\AppData\Local for vista. Delete this file while the AX client is closed. Check if other users are having the same problem : Knowing whether you are the only one that’s having that problem or if it’s a general problem is a big step towards solving the problem. For example, if you alone have the problem, restarting the AOS probably won’t solve it, but removing usage data might. Check security settings : When only some users have a problem, big changes are that it has something to do with security settings. Security can be set up from Administration > Setup > Security, on the Permissions tab. Check configuration key setup : Some features of AX won’t work if a configuration key is disabled, be aware of this. Full compile : Open the AOT, right click the AOT node and select compile. Restart AOS : Sometimes restarting the AOS solves your problem just fine. If you can, it’s worth the try as this doesn’t take long. Remove .aoi file : When the AOS is stopped, you can delete the .aoi file from the application files. This file will be rebuilt when the AOS starts. Check the Log files : There are few logs which are very important to know.
AIF Exception Log
Windows Event Log
The AIF exception logs can be accessed in Dynamics AX by going to Basic | Periodic| Application Integration Framework | Exceptions
Files with client trace are located in Client’s log directory. In default configuration it is set to either [Drive]:\Users\Public\Microsoft\Dynamics Ax\Log\
or [Drive]:\Document and Settings\All Users\Microsoft\Dynamics Ax\Log\
or[Drive]:\Program Files\Microsoft Dynamics AX\6.0\Client\Bin\DynamicsInfologTrace.log
There are differences in Dynamics AX 2009 and Dynamics AX 2012, differences in the modules, user interface, reports and many other features. The X++ MorphX reports are completely deprecated and recomended to use SSRS, The BizTalk adapter has been deprecated and replaced with WCF-compliant Services. As a developer what I see is the scope for development aspect using with Visual Studio.Net has eventually increased in MS Dynamics AX 2012. The goal of this article was to provide some useful tips and help the developers and encourage newbies to get familiarity on Dynamics AX.
There could be similar works found from other sources. How ever the objective of this article is to address the tips & solutions and few differences in Dynamics AX versions. To the best of knowledge know such work was found for matching/reference.