Change the color of task records based on date_due

Last Modified Date

Looking for a solution to change the color of task records based on date_due in dashlet list-view on the home screen? Well, you’re in luck because we’ve compiled all the steps you need to take to change the color of task records based on due_date yourself. Read on!

The solution is simple and can be achieved in four simple steps:

1.   Change type of date_due field to custom field

“date_due”  custom/modules/Tasks/clients/base/views/list/list.php

‘name’ => ‘date_due’,
‘width’ => ’15’,
‘label’ => ‘LBL_LIST_DUE_DATE’,
‘type’ => ‘date_due’,
‘link’ => false,
‘enabled’ => true,
‘default’ => true,

2.   Add date_due custom field definition in Task Module

* Customize to add Overdue functionality

    extendsFrom: ‘DateTimeComboField’,
format: function(value) {
if (!value) {
return value;
value =;
if (!value.isValid()) {

// check for due date
if(typeof != ‘undefined’ && == ‘dashlet’){
var now = new Date(),
dateOver = new Date(value);
this.overDue =  dateOver < now;

if (this.action === ‘edit’ || this.action === ‘massupdate’) {
value = {
‘date’: value.format(,
‘time’: value.format(
} else {
value = value.formatUser(false);
return value;


3.   Add list.hbs in custom due_date field

* customize to add overDue class for a field incase due date
<div data-placement=”bottom” title=”{{#unless value}}{{#if def.placeholder}}{{str def.placeholder this.model.module}}{{/if}}{{/unless}}{{value}}” >
{{#if}}<a href=”{{#if}}javascript:void(0);{{else}}{{href}}{{/if}}”>{{value}}</a>{{else}}{{value}}{{/if}}

4.    Define new class in custom.less file


.overDue{ background-color: red;}

If you’re looking for more complex SugarCRM Customization, then get in touch with us. Rolustech is a Certified SugarCRM Partner Firm with over 700 CRM Integrations and Customization under its belt. Get your Free Consultation Session and make your Sugar truly your own!

Need Help? Get Free Consultation

By clicking you agree to our Terms and Conditions

Send me news and updates

How can we help you?

Contact Sales

  • US +1 415 800 4489
  • UK +44(0)207-993-8524
  • PK +92(0)423-640-7166

Looking For a Job?