Thursday, January 2, 2014

AX Configuration in title bar

One common complaint with Dynamics AX is that it is not possible for the user to determine in which environment they are working.
Particularly for consultants/developers who often have multiple AX applications open at one time, this is very frustrating and can easily lead to errors (developing in the wrong application). 
This simple fix will display the configuration name in the main Dynamics AX window title bar. 
You need to simply override the workspaceWindowCreated() method in the info() class (special class nearly at the bottom of the Classes node in the AOT) 
This will put the current AOS and server name, as well as the logged in development layer, after the standard title bar text.

void workspaceWindowCreated(int _hWnd)
{
    SqlSystem       sqlSystem = new SqlSystem();
    LoginProperty   loginProperty = sqlSystem.createLoginProperty();
    ;
 
    // Put workspace window specific initialization here.
 
    // Show application details in title bar
    if (loginProperty)
    {
        WinAPI::setWindowText(_hWnd, strFmt("%1 - %2@%3 (%4)",                            WinAPI::getWindowText(_hWnd), loginProperty.getDatabase(),                    loginProperty.getServer(), this.currentAOLayer()));
    }
}

No comments:

Post a Comment