Friday, October 14, 2011

Company Specific Color Code

Here, I explain you how to make a form color change in Dynamics AX based on the company that was logged in.


To do this, we need to create/override run() method in SysSetupFormRun class. 


Please refer to the following code sample below. 
It shows how to change the color to red or yellow based on the company KOE or CEE.

public void run()
{
    int red;
    int yellow;
    ;


    super();


    red  = WinAPI::rgb2int(255,0,0);
    yellow  = WinAPI::rgb2int(204,255,0);


    this.design().colorScheme(FormColorScheme::RGB);


    switch(curext())
    {
        case "KOE":
            this.design().backgroundColor(red);
            break;


        case "CEE":
            this.design().backgroundColor(yellow);
            break;


        default:
            break;
    }
}

No comments:

Post a Comment