We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Set style on date field

Cirrus
Kilo Sage

Hi,

We have a scoped app with two date fields, forecast_date and delivery_date. If the forecast date is greater than the delivery date, we would like to set the field style on forecast date to color: red. Can anyone please advise how to achieve this?

Have tried creating a new style with value

javascript: newGlideDate().getNumericValue(current.forecast_date)>newGlideDate().getNumericValue(current.delivery_date)

 

but nothings happening.

2 REPLIES 2

Slava Savitsky
Giga Sage

There are three issues with your code:

  1. Missing space between "new" and "GlideDate"
  2. Usage of GlideDate API instead of GlideDateTime API
  3. Passing an argument to getNumericValue() function

 

So try this instead:

javascript: new GlideDateTime(current.forecast_date).getNumericValue() > new GlideDateTime(current.delivery_date).getNumericValue()