Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

How to add a record color to a listview in SugarCRM

Hi! In this post I will show you how to add a color to a listview in SugarCRM.

In this example, we will give all the records a red color if a field contains the value ‘Inactive’ in the Accounts module. To do so, create the following breadcrumb: custom/modules/Accounts/clients/base/views/recordlist/recordlist.js.

In the recordlist.js, add the code below:

What we do is, we search for a cell with the value ‘Inactive’. This is done by this code:

When we found that cell, we need to color this record. We need to take the tr parent and give this a certain color and delete the color of the ‘td’-elements. This is done by the following code:

Now, perform a repair & rebuild and enjoy the result:


4 comments for “How to add a record color to a listview in SugarCRM

  1. Alex
    09/09/2015 at 05:51


    I was interested in your idea but can I ask is this suitable for V6.5.x of SugarCRM or is it only possible with later versions? I ask because I can see no such path as this:



    • 11/09/2015 at 22:11

      I used it in version 7. I haven’t used version 6 so I don’t know :)..

      • Shaji
        02/02/2016 at 09:38

        Hi Laurent,

        I need to change background color of dropdown value

        For example I have dropdown “Countries” having more than 100 countries. I need to change background color of 2 countries “United States” and “Canada” only.

        I tried to do from this article (Extending the base Record view in Sugar 7 · GitHub) but not working

        Any help will be highly appreciable

        SugarCRM Professional


  2. Edouard
    07/10/2015 at 02:28


    Thanks for your article!
    Is there anyway to color the row based on a field which is not a column of the record list view?


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: