Change color Leads

Hello everyone!
I have to color the contacts when a certain status is entered.

Anyone have any suggestions?

Thank you.

Hey there,

I suppose it depends on how you’d like to colour it
(Which elements, Which View)

But, it should be possible!

There is a post from Jim Mackin, in 2016, that details how to do a little bit of colouring on the Listview of a Module, based on a field’s value: http://www.jsmackin.co.uk/suitecrm/suitecrm-list-view-conditional-formatting/

The above link is for Accounts, but it should be fairly portable to other Modules


It should also be possible on Detailview/Editview, but you’d need another approach

Some notes on this have previously been posted here, by samus-aran: [Resolved] Run javascript code on load detail view


Let us know how you get on, or if you need assistance!

Hi John
and thanks for your help.

I tried to follow the guide of the first link, but to no avail. I created the LogicHooks folder, because it was not generated, and the ListViewHighlight.php file to create the process_record.

Soon after I created the HighlightLeadsLogicHook file in the path custom / modules / Leads / HighlightLeadsLogicHook.php. I’m probably missing something.

Would you have any other suggestions?

Thank you

Hey Wise,

Hmmm

It would be worth double checking that the File Location / Class Name / Function Name in your Logic Hook is an exact match to how it is declared in the “ListViewHighlight.php” file

ie, for:

<?php
$hook_array['process_record'][] = Array(1, 'Highlight account industry', 'custom/modules/Leads/HighlightLeadsLogicHook.php','HighlightLeadsLogicHook', 'highlightLeads');
  • Double check that your file exists at: "custom/modules/Leads/HighlightLeadsLogicHook.php"
  • Ensure your Class in this file is: "HighlightLeadsLogicHook"
  • Ensure the function in this class is: "highlightLeads"

Then, if that all looks good, I’d recommend running both:

  • Quick Repair and Rebuild
  • Rebuild JS Grouping Files

In admin->Repair

Then, clear your browser cache

That should clear out all the relevant cached files, and (hopefully) reload the Listview with your custom formatting

Does it look any better afterwards?

Hi John,

I followed your suggestions but with no luck.

I have created the following ListViewHighlight.php File in the path
/ custom / Extension / modules / Leads / Ext / LogicHooks /

I have created the following HighlightLeadsLogicHook.php
File in the path
/ custom / modules / Leads /

the following file has auto generated logichooks.ext.php
in the path / custom / modules / Leads / Ext / LogicHooks /

I made all the repairs.
What am I doing wrong?

What does the PHP error log say? The one defined in the error_log directive of your php.ini.

Hi pgr,

no errors are reported in the log.

No errors at all? That would be very unusual, likely it’s because the logging settings aren’t allowing for any logging. Or do you mean that you see some messages, just not any that seem related to this issue?

You can test PHP logging by adding this line:

$WarnMeHere = 3 / 0;

And checking that you get a Warning: division by zero in the PHP log.

Hello pgr,
I always thank you for the support.
Unfortunately I am still impractical and I would like to understand if the line $ WarnMeHere = 3/0; it needs to be added to php.ini.

Excuse my inexperience again

That is a PHP command, you can put it in your class/function, or tight at the top of the PHP file (after <?php ). If your code is getting executed, and it goes across that command, it should generate the warning, and it’s a good way to check if your PHP error log is working as intended.

You can even put it in the root folder, inside index.php, near the top, that way you are sure that execution will reach it.

Hello, I can answer you beacuse I used these logic hooks before. The reason why it is not working is because of: “$bean -> Leads”. You have to call the field of a table and than apply the style (div color in this example). “Leads” is not a field in the module Leads, you can try with “first_name” for example.
So, your code is not working beacuse "Leads"is not a field, but a module.

1 Like