Changing Field Style for Problem Tasks if due date is passed

Joe Taylor
Giga Guru

I'm trying to change the font color of the due dates in the list view of PTASKS if the due date is past, but no matter what I try it doesn't seem to work.

Here's what I have now:

Table: Problem Task [problem_task]

Field Name: Due date

Value: javascript:gs.dateDiff(current.due_date.getDisplayValue(),gs.nowDateTime(),true) <  0 ;

Style:  color:red;

What am I doing wrong?

Also, where can if find a comprehensive list of styles  (colors, background, font sizes, etc.) ?

 

 

1 ACCEPTED SOLUTION

If its exceeding the field limits then you can put the code in script include and from there return true/false.

Like for yellow you could do this.

1) Create a script include (I named mine as TestDate)
find_real_file.png

 

2) Then call the script include (and function - which I named isYellow) from Styles
find_real_file.png

 

Could you please mark my answer as correct? It gives me few points on community.

Thank you!

 

-Tanaji

Please mark reply correct/helpful if applicable

View solution in original post

21 REPLIES 21

If its exceeding the field limits then you can put the code in script include and from there return true/false.

Like for yellow you could do this.

1) Create a script include (I named mine as TestDate)
find_real_file.png

 

2) Then call the script include (and function - which I named isYellow) from Styles
find_real_file.png

 

Could you please mark my answer as correct? It gives me few points on community.

Thank you!

 

-Tanaji

Please mark reply correct/helpful if applicable

lasse3
Mega Guru

It is highly recommended not to use display values, when doing scripting as this may give you unexpected results depending on display settings which may vary depending on customer regional settings etc. Instead use compareTo or numeric values when comparing dates. Here is an example:

javascript: var answer = ((new GlideDateTime(current.due_date)).getNumericValue() <= (new GlideDateTime().getNumericValue())); answer;

I hope this will help someone out there 🙂