Using Colors in Acumatica

Hi All,

Today I want to share with one way how you can highlight some Acumatica rows or data with colors or other text styles.

highlight colors in acumatica

Disclaimer: Please note that this way does not follows the standard customization way, so any changes may be not supported in future versions of Acumatica. Also it might be very complex to support this customization during Acumatica upgrades.

Before we can change colors, first of all we need to do understand how Acumatica applies styles. Acumatica uses Cascade Style Sheets (CSS). All elements (Forms, Grids, Row, Fields, Buttons, …) are associated with one or many styles. All styles are defined in Acumatica folder itself

acumatica css

You can define styles in the CSS file itself or you also can apply it dynamically using ASPX Code Behind file:

acumatica css

Styles are associated with controls statically in control or page itself. During creation of HTML system will get associated style and sent it to the browser.
Fortunately you can change it dynamically too. If we want to change it depend on some parameters, we need to add our logic before HTML is generated. The best way is when data is already populated but HTML is still not generated – OnDataBound. In case we want to change styles for each separate grid row we can use grid row related event OnRowDataBound.

acumatica css

This event handler should be defined in ASPX.Code Behind file. There you can set styles dynamically and also you can control it depend on exact values. You can get all required data right from PXGridRowEventArgs, From this class you can get rows, cells and all other required information.

acumatica css

As i said in the article header these changes cannot be done with standard customization. If you change it in the page itself it might be very complex to update this customization later.

Here is full code snippet:

Have a colorful development!
Big thanks for Acumatica Customization team.

16 Replies to “Using Colors in Acumatica”

    1. It is possible in theory. Acumatica is based on ASP.NET and all controls from the ASP.Net can be used. But please notice that saving data from control will have to be implemented manually.
      So you basically can create a control with the rating and put it there.
      However, I think the easiest way is to create a Drop down or radio-buttons (what are standard controls) and use them.

        1. Hi Koisuke, unfortunately Acumatica controls source code is closed in the platform and cannot be share. Personally I do not have example where I did it before. I still suggest to use radio-buttons instead of stars, it if is acceptable.

            1. Hi Koisuke, Acumatica CSS depend on the Theme, but in any case they are located on the file system:
              C:\Program Files (x86)\Acumatica ERP\\App_Themes\\00_Controls.css
              Hope it help!

            2. I don’t think you can “Call” css. You need to update 00_Controls.css file with your styles or classes and than assign it to the controls.

  1. Hi Prathyusha,
    Unfortunately dynamic changes of colors on controls are not easy at all. Problem is that Java script does not sync styles from server to client. So the only one way to do this is really to write a Javascript for that.
    Please contact me directly and I will share one example with you.

  2. Hi Harsha,

    If you want to use conditions in the grid, it is very easy – just check that example and see that i'm changing color based on value of Active field. (true or false)

    In case of changing colors of form controls – i'm still planing this example, but due to some issues it require time. Will post soon.

    Hope it helps.

  3. Sergey, thks for posting really useful technical tips.

    I have similar question for you regd colors, can we highlight specific fields on form and change it's background/foreground color based on certain criteria

    For eg: Change color of grid row if the line item is below stock level in Sales order Or If certain criteria is met I want to change the custom field property to turn red.

    We tried our attempt and wasn't possible appreciate your insight to this.

    – Harsha

  4. Hi Alnikko,

    I will try to prepare another example accordingly to your question. But it will take some time.

    Thank you for understanding.

  5. Not in the grid but in the FormView. Cause I tried to add a databound in a combobox from a formView screen, I tried to look for the CSS properties but failed.

  6. Hi Alnikko,

    Do you mean colors in specific fields?
    Yes, should be fine. The same way you can access cells and their styles.
    You can contact me if you have any troubles and i would be happy to assist you.

    Thank you!

  7. Hi Sergey,

    Thanks for this post, I had mine working but want to know also if how it is done in fields like, Combobox or StringList??

    Would appreciate much.

Leave a Reply

Your email address will not be published. Required fields are marked *