Dynamics AX
  RSS Feed  LinkedIn  Twitter
Want to turn you're data into a true asset? Ready to break free from the report factory?
Ready to gain true insights that are action focused for truly data informed decisions?
Want to do all of this across mutliple companies, instances of Dynamics and your other investments?
Hillstar Business Intelligence is the answer then! (www.HillstarBI.com)

Hillstar Business Intelligence for Microsoft Dynamics AX and NAV on Mobile, Desktop, Tablet


Let us prove to you how we can take the complexity out of the schema and truly enable users to answer the needed questions to run your business! Visit Hillstar Business Solutions at: www.HillstarBI.com

Monday, April 24, 2006

Changing Form color based on the current Company

I don't know about you, but I have in the past wanted a way to visually show that a user was in a given company. By default, all the forms look the same. This can be confusing for those super users that switch between companies preforming different task.

Well I came across a neat little trick that I am going to post here. I am not sure how well this will work in Dynamics AX 4.0, but for AX 3.0 it works great.

Basically you override the SysSetupFormRun.run() method. Below is some sample code:

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;

}
}


Now when you switch between the two companies and launch a form, you will see visually, that you are in a different company. Granted the WinAPI::navisionColorBeige(), ..Blue(), ..Red() are not that great looking, but still you get the idea. And if you know RGB colors, then you can supply really any valid RGB color you like!

Anyway this is a neat little trick that is ran each time a new instance of a given form (other that the main menu) is ran.

Well check back soon for more helpful hints!



Find a job at: www.DynamicsAXJobs.com

6 Comments:

Anonymous Anonymous said...

This comment has been removed by a blog administrator.

6:37 PM  
Anonymous Anonymous said...

Hi all,

It's great !

There is another sample like this in www.trucosax.com in downloads/tunning Axapta. This one lets the user choose what color he wants for every company. (must be registered user to download it :( )

Best regards,

Mkz.
---------
www.trucosax.com
A Dynamics Ax (Axapta) tricks site in Spanish language :)

11:04 AM  
Anonymous Scott Arthur Edwards said...

This comment has been removed by a blog administrator.

11:19 PM  
Blogger Joe Berenguer said...

Hi, Fellow!I like your blog!
I just came across your blog and wanted to
drop you a note telling you how impressed I was with
the information you have posted here.
I have a job portal
site. It pretty much covers job portal related subjects.
Come and check it out if you get time :-)
Best regards!

6:20 AM  
Blogger Dom said...

I wonder why does the code for setting the color scheme must come after the super() call in Run() method to work.

Also, if one changed those 2 properties @ AOT object before running the form, the result seems different.

Is there any reference/information about such behavior that I can read?

Cheers

2:36 AM  
Blogger by Reiff Lorenz said...

Hey,

I used a version of your code to change the color of the forms in our testing / training environment. This will help keep our company's employees from accidentally working in the wrong environment.

See it here:
http://discoverax.blogspot.com/2007/12/color-code-your-dynamics-environments.html

Thanks for all the suggestions!

Reiff Lorenz
http://discoverax.blogspot.com/

9:25 AM  

Post a Comment

Links to this post:

Create a Link

<< Home


Copyright 2005-2011, J. Brandon George - All rights Reserved