Start and open a specific record in Dynamics Ax 2012

At work we recently discussed ways to startup Dynamics AX 2012 and navigate to a specific record. The requirement was to open Dynamics AX from a DMS client that manages invoices and other documents.

There are different approaches to achieve this goal. One way is to use the Startup Command framework which is used to instruct Dynamics to execute several functionalities during startup e.g. compile, synchronize or navigate to a menu item. In order to startup a menu item, you provide an XML file which contains the menu item name and point to this file from the .axc Dynamics AX configuration file.

Startup Dynamics AX 2012 with an XML configuration file

Reference the record in the startup XML file

For many forms in Dynamics AX it is sufficient to call the corresponding menu item with an Args object that holds the record. To specify a record in Dynamics AX you need to provide at least the TableId and the RecId. For example the Customer “Adventure Works” can be defined by using TableId 77 (CustTable) and the RecId 22565422070. Add two additional attributes RecId and TableId to the XML file which is used to open the CustTable form. The XML file looks like this:

<?xml version="1.0" encoding="utf-8"?>

Modify the SysAutoRun.execRun() method

At the SysAutoRun class, open the execRun() method. At the top declare the following variables:

RecId recId;
TableId tableId;
Args arg = new Args();
Common common;
DictTable dictTable;

At the bottom, find the place where a menu item is started. Before the if(mf) statement add the following code to read the RecId and TableId from the XML file and select the corresponding record:

recId = str2int64(this.getAttributeValue(_command,'RecId'));
tableId = str2int(this.getAttributeValue(_command,'TableId'));
if(recId != 0)
   dictTable = new DictTable(tableId);
   common = dictTable.makeRecord();
   select common where common.RecId == recId;

Within the if(mf) block, add the Args object when the menu fuction is called to pass the record.

mf = new MenuFunction(name, menuItemType);
if (mf)
   this.logInfo(strfmt("@SYS101206", mf.object(), enum2str(mf.objectType())));;
   result = true;

Test your configuration

Now you can test your configuration. Create a new .axc file and point it to the XML file. Make sure the XML file has a valid TableId and Recid property. Start Dynamics AX using the .axc file and the defined menu item should open and view the record.

SSRS: Error when opening design of duplicated report

When you duplicate an SSRS Dynamics AX 2012 report in Visual Studio, and you try to open the design node you may get an error message like “object instance not set to an object”. The reason is that the data set parameters contain the name of the report e.g. SalesQuotation. Now that you have duplicated the report its name is CopyOfSalesQuotation and the report is broken.

Broken parameter in duplicated SSRS report

Compiling the report project brings up a list of errors.

Errors when compiling a duplicated report

Navigate to each data set parameter and change the name of the report to match the new name e.g. CopyOfSalesQuotation instead fo SalesQuotation

Broken parameter in duplicated report

The fixed parameter should look like this

Dynamics AX 2012 duplicated report data set parameter

Finally the report designer is working

Dynamics AX 2012 duplicated report in report designer

Dynamics AX 2012 on Windows Server 8 Beta with SQL 2012 RC0

Microsoft recently released Windows Server 8 Beta and Windows 8 Consumer Preview. So my first though was about running Dynamics AX 2012 on Server 8 and Windows 8. However, installing AX 2012 on Server 8 failed due incompatibility with windows installer. But Windows Server 8 and Windows 8 Betas still come with an upgrade option. So I had the idea install AX 2012 on Server 2008 R2 and upgrade to Windows Server 8 Beta.

Prolog (the IBM x3400 thing)

We’ve bought an IBM x3400 M3 server for a customer. We’re still waiting for some hard disks to deliver, so the server is unused and becomes my testing platform for the moment. Installing Windows 8 Beta was straight forward, but as mentioned installing AX 2012 failed. So next I failed installing Windows Server 2008 R2 because no hard disk was found (missing driver). The solution:

servers   usb driver

IBM x3400 M3 and Raid driver on USB for Windows Server 2008 R2 installation

Windows Server 2008 R2, SQL Server 2012 RC0

Next I’ve joined the new 2008 R2 server to our domain. Loving Betas, Previews and other unstable stuff I’ve installed SQL Server 2012 RC0 to serve as database server for AX.

  • Installed .NET Framework 3.5.1 Feature using Server Manager
  • Installed .NET Framework 4.0 Full package
  • Installed NDP40-KB2390372-v2-x64 patch for .NET 4.0
  • Installed C++ Runtime Environments from AX 2012 DVD
  • Installed SQL Server Native Client
  • Installed Report Viewer 2012 from AX 2012 DVD
  • Installed Identity Foundation from AX 2012 DVD
  • Installed Open XML SDK for Office from AX 2012 DVD
  • Installed SQL Server 2012 RC0 full featured

    sql sql2

    SQL Server 2012 RC0 Full Featured

    Pizza Break

    Ham, Eggs, Bacon, Onion and Corn, Coke and Tiramisu

    Pizza and Tiramisu

    Admin’s workplace Smiley

    Dynamics AX 2012

    AX on SQL 2012 RC0 is a little bit tricky, because even database creation failed. So I’ve set up an AOS using another SQL Server 2008 R2 with an existing AX 2012 database and baseline. Next I restored an AX 2012 database from a backup in SQL 2012 RC0 and configured the AOS to use it. Works as it should. However, the reporting extensions are not compatible with RC0 and installation failed.Dynamics AX 2012 with SQL Server 2012 RC0

    AX 2012 using SQL 2012 RC0

    Upgrade to Windows Server 8 Beta

  • Installed Windows Server Backup Feature from Server Manager and create a backup
  • Downloaded Server 8 ISO
  • Extracted it and copied it onto an USB stick using xcopy *.* /s/e/f u:\\
  • Started Upgrade from DVD or USB
  • The Upgrade took quite a lot of time until windows was ready

    Windows Server 8 Beta Upgrade

Windows Server 8 Beta Data Center Edition with GUI

Windows Server 8 Beta Upgrade

Upgrade an existing Installation

Windows Server 8 Beta Upgrade

Windows Server 8 Beta is starting up, …

Windows Server 8 Beta Start Screen

Finally! Windows Server was upgraded from 2008 R2 to 8 Beta

Repairing Dynamics AX

Well, Windows as upgraded successfully but Dynamics AX is not working any more Trauriges Smiley Starting the AOS results in an error. Reviewing the windows event error logs brings up the details:


Object Server 01:  Error accessing registry: Cannot open key SYSTEM\CurrentControlSet\Services\Dynamics Server\6.01. Error code: 0

Object Server 01:  The directory "C:\Windows\system32\\bin" does not exist or access to it has been denied by the operating system.

Object Server 01:  The home directory for Axapta (C:\Windows\system32\) does not match the required structure or can not be accessed. Please check installation, configuration and access rights.

Object Server 01:  Server terminated unexpectedly with 10 exitcode.

The reason is an missing registry key:


I solved this issue by importing an AX configuration from another server’s registry

  • Opened an RDP session to an other 2008 R2 server running an AX 2012 AOS
  • Start > Run > regedit
  • Navigated to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynamicsServer\60
  • Exported the registry key as file (Context Menu > Export)
  • Copied the .reg file the Server 8 Beta desktop and imported it
    There are a lot of settings and paths in the registry, make sure these settings apply to your w8 server
  • Started the Server Configuration Utility and changed the database setting back to localhost
  • Started the AOS
  • Started the Client

Dynamics AX 2012 on Server 8 Beta

Dynamics AX 2012 running on Windows Server 8 Beta