Adding style to Incident Number in list view when follow up time is within next one hour.

JuileeD
Tera Contributor

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

7 REPLIES 7

@JuileeD 

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()

AnkurBawiskar_0-1742562733809.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@JuileeD 

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&colon; GlideDateTime.subtract(new GlideDateTime(), new GlideDateTime(current.due_date)).getByFormat('HH') <= 1

AnkurBawiskar_0-1742564457764.png

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.

field style due date within 1 hour from now.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@JuileeD 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader