- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2021 02:06 AM
Hello,
I have one field on form and I want to show it in red colour when the record is in-active.I have added styles in configure styles but its working only in list view not on form..can anyone suggest whats wrong here..
Table :xyz
Field name : Name
Value : javascript: current.status='Active'
Style : background-color:red
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2021 02:11 AM
Hi,
if you give value then it would apply only on list
to make it work on form do this
create onLoad client script
function onLoad() {
var control = g_form.getControl('status');
var status = g_form.getValue('status');
if(status.toString() == 'true'){
control.style.color = 'blue'; // to set the color of field
control.style.backgroundColor = "red"; // to set the background color
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2024 09:24 AM
In Forms, it actually only sets the background color when it's not an interactive field. That means..
If you set the target field to "read only" your configured field style would work in forms too.
If it needs to be editable. Then there is only the way via client script.