Friday, February 22, 2013

Adding a color bar per company

A common question users often ask for is to change the color of AX forms when logged in to a different company. This comes from may legacy systems having this behavior. It turns out changing the background color on AX form results in a pretty ugly experience due to the many different layouts of form, group and subgroups, and other controls that would all have to have their backgrounds changed.

However one interesting way I found to provide similar behavior to this is to add a color bar across the top of forms similar to the workflow status bar indicating the company logged in to.



As you can see from my screenshot I also added a small company flag icon as eye candy. I'll clean up my example and provide a sample xpo project when I get a chance, but this customization needs to be made in the SysSetupFormRun.init() method. Care needs to be taken on the placement of the bar and also to restrict the bar to only certain type of forms. In my environment I am showing this on most forms but am hiding it on lookups (due to some inconsistent behavior in that scenario).

I'm using this in AX 2009 but I tested it in AX 2012 and it seems to work as well. With my current code it was showing up on Fact boxes, but I think these could potentially be excluded in a similar way to how I am excluding lookups.

This modification in conjunction with the modification to suppress the change company warning greatly enhances the experience for users working in multiple companies.

I added a small setup form to specify the color per company, but there are many other ways this could be enhanced. For instance, you could allow users to select their own color per company. Let me know in the comments below what other interesting ways you found to use this.

3 comments:

  1. Did you ever post the code on how to add a color bar to the forms.

    ReplyDelete
  2. I could not find sample code chunk or changes you referred in this blog post, please update the same in this post.

    ReplyDelete
  3. Sorry for the very late response on this. I haven't posted the code up until now, but I recently started moving my code samples over to GitHub as open source repositories and will do this one next. I'll reply back when it is there. Did either of you follow my description above and use this?

    ReplyDelete