- 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: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:08 AM
Thanks ankur , will this work in portal too ? if we select UI type as both ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 09:10 AM
Can you please explain the code ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2020 09:40 AM