Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

Listview record color

Hi, I would like to know how to set a certain color for a record in a listview, based on certain conditions.
I found this solution:

it should do what i’m interested in, i followed the instructions applied to my custom module, but it doesn’t work, no change is considered, not even after a Q&R. I tried to delete the whole file, to see if something happened, but nothing happens, it’s as if that file (ListViewGeneric.tpl) is not considered at all.
Can anyone give me a solution? Thanks.

1 Like

OK, thanks! Wanting to color the entire row?

Not possible with that mechanism, I think. You can redefine the whole view, so there’s really not much limiting your possibilities, you can inject JS to detect conditions and apply formatting. The real concern is finding something that doesn’t get too complicated and is worth the effort.

Can you tell me which files I should modify? At least to do some testing.
The link I posted at the beginning, how do you consider it?

I never tried it, it will probably work just fine BUT it doesn’t seem to be upgrade-safe.

Maybe that’s why your changes weren’t applying, were they made in custom dir?

You can check the compiled version of the template to see what’s going into the file: cache/smarty/templates_c/%%AF^AF1^AF13FE7B%%ListViewGeneric.tpl.php (that part with codes will vary). You can also delete that file to ensure it is recreated after changes.

Just one more thing, if you get it to work from the tpl, it probably can be made upgrade-safe. The trick is always the same: if a file is not customizable, maybe the one that references it is. You go and do it “one file earlier”.

See this example of a custom list view here:


See that place where it’s invoking the tpl? You can make your custom list view that loads a custom tpl, right there, thus making the whole thing upgrade-safe.

this is the content of the file you pointed me to:

Smarty version 2.6.31, created on 2022-05-09 15:25:19
compiled from themes%5CSuiteP%5Cinclude/ListView/ListViewGeneric.tpl

I’d see if it works by modifying the original first, then worry about making it upgrade-proof