- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2020 06:05 AM
Hi all ,
I want to add some background colours to some fields based on the score in some another field.For e.g the score fields value is 1-5 then the background colour should be green and if between 6-10 it should be yellow.
How can I add colours in the background?
Solved! Go to Solution.
- Labels:
-
Risk Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2020 03:29 PM
Hi all, no need for client scripts !
This can be done using the field styles. https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/navigation-and-ui/task/t_DefineFieldStyles.html
Take the example of Control, being compliant/non-compliant , in List view:
Or Compliance Score Percentage:
in navigation bar type sn_compliance_policy.config and look at the styles list:
you will notice, use of javascript: which enables you to access the current record fields and perform some logic. if this returns true, the style will be applied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2021 08:12 AM
Hi Phil 🙂
Just found this post while looking for something similar. I believe this is only true if the field is rendered as read-only.
I've not found a supported way to apply background colours to fields on the form if the field is editable.
Having said this, I am struggling to think of a use case for a colouring an editable field.
All the best