Thursday, August 19, 2010

Change form color company wise

Hi,

I found a beautiful thing while searching for AX dev. from http://discoverax.blogspot.com/2007/12/color-code-your-dynamics-environments.html

following code explain that how to set form's color company wise.

public void run()
{
;
super();


// Set the color scheme of this instance of te SysFormRUn to RGB
this.design().colorScheme(FormColorScheme::RGB);

// Switch and based on the current company change colors, or not for default
switch (curext())
{

case 'DEM':
this.design().backgroundColor(WinAPI::navisionColorRed());
break;

case 'dat':
this.design().backgroundColor(WinAPI::navisionColorBeige());
break;

default:
break;

}
}

Some points:

1. Here curext() will return the current extension for the current company.
2. To get current company name, SRSVSToolsSupport::getFullCompanyName(curext())
3. You can also use appl.company.ext() to get the current extension but will makes a call to server tier which is not effective in some cases.


Thanks,
Ashlesh

No comments:

Post a Comment