Apply Field Style to Any Value

tstocking
Tera Guru

Is it possible to apply a field style to any value of that field and not just a specific value?   If I leave the value field blank, the style doesn't apply.   If I enter a single value, then it applies but I would like to format the field with the field style all the time.   mlockhart

1 ACCEPTED SOLUTION

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Todd,



Have you tried using a javascript in the "value" field, like explained on our wiki? In javascript you can add condition if value is empty (like for example "javascript: current.state == ''", where state is the field), but you'll have to test it.



Defining Field Styles - ServiceNow Wiki



Regards,


View solution in original post

7 REPLIES 7

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Todd,



Have you tried using a javascript in the "value" field, like explained on our wiki? In javascript you can add condition if value is empty (like for example "javascript: current.state == ''", where state is the field), but you'll have to test it.



Defining Field Styles - ServiceNow Wiki



Regards,


Works for me.   The field is an integer field so I just set it to javascript:   current.u_count > 0; since it's always going to be a positive number.   Thanks!


How do you get this to work on a calculated field that calculates how long an incident's been open?


I figured it out. I set it to "javascript:!current.isNil();"