Adding style to Incident Number in list view when follow up time is within next one hour.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 04:51 AM
Hello folks,
We got a requirement of highlighting (adding '!' icon similar to 'vip' icon) Incident Number in list view if:
The time on 'Follow up' field is within one hour from current hour.
I created a field style in 'sys_ui_style' and have tried every possible code/logic. Yet nothing helps adding the icon to Incident Number in list view.
Any lead/help would be much appreciated.
Thanks in advance,
Juilee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 06:12 AM
share the script, did you try running your script in background and see if your function is giving true/false?
check few OOB field styles and they are using dateDiff()
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 06:45 AM
this worked for me in field style, you enhance for your requirement
I believe I have answered your question and you can take it further from here.
javascript: GlideDateTime.subtract(new GlideDateTime(), new GlideDateTime(current.due_date)).getByFormat('HH') <= 1
Output: my timezone in preferences is GMT so I set some due dates within 1 hour from now, so it showed the field style correctly for those records in list.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2025 09:36 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader