Since implementing Axapta / Dynamics AX in 2003, we've found it invaluable to provide an environment for testing and training as well as our live system (or production environment) to end users. This lets people try different processes or train new employees without fear of screwing up the "real" data.
Occasionally, though, we've run into a problem where someone thought they were using the live system, but were actually in the test environment. It's an easy mistake to make. There is no obvious visual cue to alert a user that they are working on a test system.
There is a way change the color of the Dynamics forms to help indicate what environment is in use. It involved overriding the SysSetupFormRun.run() method, which will be called every time a form is opened. On the class SysSetupFormRun, create a new method with this code:
public void run()
{
SysSQLSystemInfo systemInfo = SysSQLSystemInfo::construct();
;
super();
// Set the color scheme of this instance of the SysFormRun to RGB
this.design().colorScheme(FormColorScheme::RGB);
// If the database name is not the live version, change the color of the form
if (systemInfo.getloginDatabase() != 'MyDBName')
this.design().backgroundColor(0x112255);
}
That's all there is to it. If your live and test systems use the same database name, but the AOS is running on different servers you can modify this code to to match on systemInfo.getLoginServer() != 'MyServerName'. You can change the color by setting the hex value. It uses the RGB values in reverse order: 0xBBGGRR.
Variations of this code could switch form colors to indicate the current user account, application layer, or company. Less practical uses could match color to the time of day or season of the year. If you find this code useful, leave me a message noting what you did with it.
=========================
Special thanks to Brandon George and his Dynamics AX blog for help with form colors.
For more information on changing form colors and sample code for version 3.0, see:
http://dynamics-ax.blogspot.com/2006/04/changing-form-color-based-on-current.html
=======================
Sample screens showing how the code above changes the test environment forms compared to the same form in the live production environment.
Sunday, December 16, 2007
Color-code your Dynamics environments
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment