- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 08:49 AM
Hi
How do we change the color of a label field on catalog item and service portal
We have a label name u_test which has a question" this is test "
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 09:02 AM
Hi,
Do you want the color when form loads?
if yes then use onLoad client script
Ensure Isolate Script is set to false for this client script; this field is not on form but from list you can make it false
function onLoad(){
var getLblParent= g_form.getElement('u_test').id.replace('sys_original.','');
var getLblElement = $j("label[for='"+getLblParent+"']").css('color','red');
}
Isolate Script: False
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
05-29-2020 09:44 AM
No, i mean in native view and in portal ?
and can we increase the size of the text ?
Can we set only some part of the text Red ? ie "This is Test " just Test in red color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 10:24 AM
Hi,
the above script would work well in catalog item view and once RITM is generated.
It won't work in portal as jquery has issue on potal
not sure if you can make some part of text as Red but that also would work in native and not in portal if it is achieved
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
05-29-2020 09:12 AM
Hi Kam

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 09:15 AM
Please check below for solution to change label color for service portal and platform view
https://community.servicenow.com/community?id=community_question&sys_id=45f7cb2ddb1cdbc01dcaf3231f9619fb
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 09:23 AM
var getLblParent= g_form.getElement('label_test').id.replace('sys_original.','');
var getLblElement = jQuery("label[for='"+getLblParent+"']").css('color','red');
try using client scripts
https://www.servicenowguru.com/system-ui/ui-scripts-system-ui/modifying-label-form-fields-client-scr...
https://community.servicenow.com/community?id=community_question&sys_id=1d076eefdbffd74067a72926ca96...
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat