Change font weight and size on a label variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 08:56 PM
Hello,
We would like to change the font weight and size of a few label variables in one of our catalog items that is accessible from the Service Portal. I've seen several older posts addressing this topic and I have tried an onLoad script suggested, g_form.getControl('label_variable').setAttribute('style', 'font-weight: bold;color:red'), but I get a javascript error.
I have also seen references to setLabel(), but I can't find any helpful documentation that further explains usage.
Is this acheivable? Many thanks in advance for your assitance.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 09:40 PM
Hey ddenar,
Refer the threads below it will help you:
Mark Correct and Helpful if you find my response worthy!!!
Best Regards,
Namrata.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 09:47 PM
Hi,
In addition to
https://www.servicenowguru.com/system-ui/field-styles-service-catalog-variables/
Thanks,
Kunal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2020 07:50 AM
Hi Kunal,
Thank you for your reply. I had already tried the suggestions in the article you recommended. This is one of the attempts where it throws a java script error. When UI type is ‘Desktop,’ I don’t see the error, but as well, the script does not work to apply the bold style to the label.
function onLoad() {
//Set styles for the 'office_request_options' label variable
var myVar2 = g_form.getControl('office_request_options');
myVar2.style.fontWeight = 'bold';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2021 01:21 PM
Brandon