How to change the color of the Form Header and List Header?

Karl Dietrich
Kilo Sage

Hello there,

I'm new to the community and I want to customize the color of the form header and the list header. I found a Script on SN Guru but it dosen't work. 

function onLoad() {
//Change the color of all form section headers
var backgroundColor = 'red';
$$('.navbar').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
});
}

Thanks in advance

1 ACCEPTED SOLUTION

Hi,

Then in that case have it in a UI script. Can you try this and check once. I tested and it is working fine for all table form headers

Ensure global is set to true for UI script

Something similar to this

(function() {
addAfterPageLoadedEvent(function () {

var backgroundColor = 'red';
$$('.navbar').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
});

});
})();

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it is working in my instance. What error you are getting in browser console?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Karl Dietrich
Kilo Sage

So I made some progress. I discoverd that you need to create a system property before your client script will work, with glide.script.block.client.globals = false. That ist nice but it change the color only for one Form at a time.
Maybe some of you guyes know a way to make a globale change, so that every List an Form Header are the color i want them to be.

Hi,

Then in that case have it in a UI script. Can you try this and check once. I tested and it is working fine for all table form headers

Ensure global is set to true for UI script

Something similar to this

(function() {
addAfterPageLoadedEvent(function () {

var backgroundColor = 'red';
$$('.navbar').each(function(elmt) {
elmt.style.backgroundColor = backgroundColor;
});

});
})();

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader