Set style on date field

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2024 08:34 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2024 10:23 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2024 10:37 AM
There are three issues with your code:
- Missing space between "new" and "GlideDate"
- Usage of GlideDate API instead of GlideDateTime API
- Passing an argument to getNumericValue() function
So try this instead:
javascript: new GlideDateTime(current.forecast_date).getNumericValue() > new GlideDateTime(current.delivery_date).getNumericValue()
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/