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:


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

Leave a Reply

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

%d bloggers like this: