At this point I’m 99% sure almost all of us have been asked the “can we change the theme color to the one of our company/brand?” question. While this is unfortunately not possible what we can do is defining a different theme for each company.

This is just a proof of concept. I still haven’t managed to successfully change the theme when the DataArea is changed using the company list.

The standard

By default each user sets his desired theme in the user settings:

User info

If you check the SysUserInfo table you’ll find the enum Theme field, its type is SysUserInfoTheme. This enum is not extensible and this is one of the reasons we cannot add new colors (the other is the class which handles the themes being not accessible).

The customer might ask us to set a fixed different color/theme for different companies. To be sure that the users don’t misidentify different companies or even environments.

Let’s do it

For this example I’ve decided to add an override on the Legal Entities form and set the new theme to be used there.

Add a new SysUserInfoTheme enum field to the CompanyInfo table:

SysUserInfoTheme

Then add the field to the OMLegalEntity form:

OMLegalEntity

We now have a list of the available themes. Let’s add the functionality.

If we do a metadata search of the SysUserInfo Theme field we’ll find it’s being used by the SysFormUtil class in the GetThemeDensityForCurrentUser. We’ll extend this method in the following way:

By returning our field’s value we make the system select the value from the CompanyInfo table instead of the one defined by the user. For example:

USMF

USMF

THMF

SAMF

Different companies, different themes!

Now I only need to find a way to make this work when changing companies. I’ve tried with the lookup form which shows the available companies with no luck. Any ideas?

La entrada Override the default theme per company (proof of concept) se publicó primero en ariste.info.