- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:46 AM
Hi Experts,
I have one requirement to highlight the start date field with red color if the date is in past if we compare with the current date when we are filling the form. Please give your inputs on this.
Best Regards,
Prachi
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 05:13 AM
Hi Prachi,
Use the code -
javascript: GlideDateTime.subtract(new GlideDateTime(current.avventer_svar_innen), new GlideDateTime()).getDayPart() > 0;
Refer the community article - https://community.servicenow.com/community?id=community_question&sys_id=4e8a6f36db81041023f4a345ca961997
Regards,
Deepankar Mathur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:49 AM
You can configure background color from styles.
From the form go to Configure -> All there you will get styles. You can configure style for every field based on conditions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:56 AM
Hi Prachi,
You have to Configure field style
Value : javascript: (gs.dateDiff(current.startDate.getDisplayValue(), gs.now(), true)) > 0
Style : background-color:Red;
refer thread : add style to number Field
Kindly mark correct and helpful if applicable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:59 AM
Hi Prachi,
You can create style with the given conditions. Refer below screenshot for details
javascript:gs.dateDiff(current.due_date.getDisplayValue(),gs.nowDateTime(),true) > 0 ;
Let me know in case of any queries.
If you think my response is helpful for you? If yes, mark it as correct answer and close the loop so that it would help future readers as well.
Regards,
Deepankar Mathur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 05:08 AM
Hi Deepankar,
I have created this style but this functions are not working with my scoped application. Is there any replacement for this two functions.
I was writing this-
javascript:GlideDateTime.subtract(current.start_date.getDisplayValue(), gs.nowDateTime(),true) <0
Thank you for your reply