Sunday, April 19, 2015

AX 2012 - How to fix Data Dictionary ( SqlDictionary ) issue after importing a Model, ModelStore or during the TFS BUILD Process

Hi All
During the development phase, many tasks are made on the Data Dictionary.
Create tables and fields, rename or delete them.
So, often the Synchronization process failed.
To avoid this issue, you can create a process that fix the SqlDictionary Table.
During the time, I created many Jobs.
The main started from the Martin post with the following changes :
1.       To avoid the duplicate key, I read the fields starting from the last one.
2.       For each table, I delete first the fields from the SqlDictionary that no more exist on AOT
If you use the TFS Build, before the Synchronization you can run the above job.
The same during the Modelstore transportation scripts.
Here the code :

    Dictionary dictionary = new Dictionary();
    SysDictTable dictTable;
    DictField dictField;
    TableId tableId;
    FieldId fieldId;
    Counter fieldCnt;
    SqlDictionary sqlDictionaryTable;
    SqlDictionary sqlDictionaryField;
    setPrefix("Update of data dictionary IDs");
    tableId = dictionary.tableNext(0);
    while (tableId)
        dictTable = new SysDictTable(tableId);
        if ( dictTable.isSystemTable()
        ||   dictTable.isView()
        ||   dicttable.isTempDb()
        ||   dictTable.isTmp()
            tableId = dictionary.tableNext(tableId);
        //Finds table in SqlDictionary by name in AOT, if ID was changed.
        //Empty field ID represents a table.
        select sqlDictionaryTable
            where ==
            && sqlDictionaryTable.fieldId == 0
            && sqlDictionaryTable.tabId !=;
        if (sqlDictionaryTable)
            //Updates table ID in SqlDictionary
            if (ReleaseUpdateDB::changeTableId(
                info(strFmt("Table ID changed (%1 -> %2)", sqlDictionaryTable.tabId,;
        // Delete Fields that no more exists in AOT
        while select forUpdate sqlDictionaryTable
            where sqlDictionaryTable.tabId ==
            &&    sqlDictionaryTable.fieldId
            If ( ! dictTable.fieldName2Id( ) )
        //fieldId = dictTable.fieldNext(0);
        fieldCnt = dictTable.fieldCnt();
        fieldId = dictTable.fieldCnt2Id(fieldCnt);
        //For all fields in table
        while (fieldCnt)
            dictField = dictTable.fieldObject(fieldId);
            if (dictField.isSql() && !dictField.isSystem())
                //Finds fields in SqlDictionary by name and compares IDs
                select sqlDictionaryField
                    where sqlDictionaryField.tabId ==
                    && ==
                    && sqlDictionaryField.fieldId != 0
                    && sqlDictionaryField.fieldId !=;
                if (sqlDictionaryField)
                    //Updates field ID in SqlDictionary
                    if (ReleaseUpdateDB::changeFieldId(
                        info(strFmt("Field %1 - ID changed (%2 -> %3)",
            //fieldId = dictTable.fieldNext(fieldId);
            fieldId = dictTable.fieldCnt2Id(fieldCnt);
        tableId = dictionary.tableNext(tableId);

Thursday, April 16, 2015

Change the TITLE of the AX Main Window


When you open Dynamics AX, the main windows is a form.
So, if you want to change the Title, the code is very easy :
WinAPI::setWindowText( infolog.hWnd(), "Magic AX")
If you want to manage automatically,is enough move this code to the startupPost method of the Info class.
If you want trigger this code for every workspace, you have to move the code on the workspaceWindowCreated method of the Info class, like this :
WinAPI::setWindowText( _hWnd, "Magic AX");
Stay Tuned!

Sunday, April 12, 2015

Second MVP Award on Dynamics AX

Hi All

Is a pleasure announce the renewal to the Microsoft MVP on Dynamics AX!

Although very busy with my daily activities I am happy to share my knowledge with others in the world.
Become an MVP mean enter in a big family, get in touch with other fantastic guys also in other expertise and finally get in touch with Microsoft!
With Yammer, direct message, etc. I have the opportunity to reach the best people in the world that can help me in my daily activities.

Finally, a big thanks to the others MVP on Dynamics AX, always available.
You can find and see them to the follow LINK

Look through this Video to resume my reaction in Office... -))

Enjoy with Dynamics AX!

Saturday, February 28, 2015

AX 2012 - Debug doesn't work, breakpoint doesn't stop

Hi Guys

About this topic, you will find many post in google.

With my, I just want to underline a strange behaviour that I have faced.
Pratically, in my scenario, the Debugger opened ( with many "flash" ) but doesn't stop to any code.

So, after check the Microsoft links :

without success, I realize that the problem was related to the User Account Control (UAC) enable!

So, I have open Dynamics AX with administrative privileges and all worked fine!
Obviously, you can disable the UAC.

See you soon!

Monday, December 8, 2014

AX 2012 DIXF Service is unavailable or The client and service bindings may be mismatched

Hi Guys

If during the Data Import Export Framework validation parameters, you faced the errors :

1- DIXF Service is unavailable


2- System.ServiceModel.ProtocolException: Content Type application/soap+xml; charset=utf-8 was not supported by service http://Servername:7000/DMFService/DMFServiceHelper.svc.  The client and service bindings may be mismatched. ---> System.Net.WebException: The remote server returned an error: (415)......

You have to :

1- Unistall the DIXF AOS Component and reinstall it.
During the installation you will be able to specify the server name where Integration Services is Up & Running

2- Go through the Bin folder of the AOS Server, locate and edit the file Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config, set the endpoint address as :
Practically specify the Server where Integration Services is running.

More info at

Stay tuned!

Sunday, October 12, 2014

Dynamics AX issue ? No problem...

Hi All

In our job, often we have faced some errors or strange behaviors.
Also, often I seen a wrong approach about on figure out the issue.

In many case, the developers try to figure out the issue using debug.
In complex scenarios, the debug approach can take a lot of time and sometime not produce any result.

From my point of view, when we face an issue, the steps are:

1-  Check if there is already a hotfix provided by Microsoft using Lifecycle Services,, especially Issue Search.

2-   Search or post a question on the Microsoft Dynamics AX Community,
      Here you can work with many people that probably have already faced your issue and that can help in the right way to solve.
      Additionally, on MS AX Community you will have the pleasure to work with people that have a lot of seniority on Dynamics AX, both Technical that Functional.

3-   Raise a case on Microsoft,
Often, the Microsoft reply is very quick if found the issue in their internal database.
Otherwise, is needed some days just to replicate the case on their environment and provide you the relative hotfix.
Finally, you have the opportunity to help Microsoft to improve Dynamics AX and so have a product more stable for other Customers.

4-  Lastly, before debug, involve your functional colleague just to figure out if the issue can be related to a wrong setup.

Finally, if you have in mind something that could improve the product, submit your suggestions using Microsoft Connect,

Speak soon!

Thursday, September 4, 2014

AX 2012 - Retrieve a Dimension Value from a Index

Hi Guys

Below an useful code for retrieve a Financial Dimension value from an Index :

static DimensionValue DisplayDimensionValueFromIndex( DimensionDefault _DefaultDimension, int _level)
        DimensionValue      ret;
        if( _defaultDimension && _level )
            select RecId, Name
            from LedgerChartOfAccounts
            where LedgerChartOfAccounts.Name == curext()
                join ChartOfAccounts, DimensionHierarchy
                from LedgerChartOfAccountsStructure          
                where LedgerChartOfAccountsStructure.ChartOfAccounts == LedgerChartOfAccounts.RecId
                    join DimensionAttribute, DimensionHierarchy, Level
                    from DimensionHierarchyLevel
                    where DimensionHierarchyLevel.DimensionHierarchy == LedgerChartOfAccountsStructure.DimensionHierarchy
                       && DimensionHierarchyLevel.Level == _level;
            ret = DimensionAttributeValueSetStorage::find(_DefaultDimension).getDisplayValueByDimensionAttribute(DimensionHierarchyLevel.DimensionAttribute);
        return ret;