Color-code your Dynamics environments

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 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();


// Set the color scheme of this instance of the SysFormRun to RGB;

// If the database name is not the live version, change the color of the form

if (systemInfo.getloginDatabase() != ‘MyDBName’);

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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: