Change Row color in listview of module – Sugar crm

Here we are showing the rows of cases with background color if the case has received any email in email table in last 24 hours.

Create the custom/modules/Cases/logic_hooks.php file and Add below code in it.
LoadImage() function will be called when each row will be loaded.

$hook_array[‘process_record’] = Array();
$hook_array[‘process_record’][] = Array(1, ‘ShowImageinListView’, ‘custom/modules/Cases/CaseHooks.php’,’CaseHookClass’, ‘LoadImage’);


create the file like custom/modules/Cases/CaseHook.php and Add below code in it

class CaseHookClass {

* This Function is Used to set Image in the Listview of Case module depends on the Followup of Case
* process record hook
* @param object – $bean
* @param string – $event
* @param array – $arguments
* @return bean

public function LoadImage(&$bean, $event, $arguments) {

$case = new aCase();
$mail = new Email();
$mail->retrieve_by_string_fields(array(‘parent_id’ => $bean->id));
// show the row highlight color if the the case has mail in last 24 hours
if (!empty($mail->date_entered)) {
//echo $mail->date_entered.”==”.$mail->date_modified.”==”.$mail->date_sent.””;
$TwentyFourHourAdded = strtotime(‘+1 day’, strtotime($mail->date_entered));
$TwentyFourHourAdded = date(‘Y-m-d H:i:s’, $TwentyFourHourAdded);
//echo $TwentyFourHourAdded . “==” . $CurrenrDateTime . “”;
if ($CurrenrDateTime < $TwentyFourHourAdded) { $bean->case_notice_c .=”“;




create the file like custom/modules/views/view.list.php and Add below function it

class CasesViewList extends ViewList {

function CasesViewList() {



function display() {
global $db;
$css = <<<EOQ

echo $css ;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s