How can I highlight a Related List Tab?

qz8437
Mega Contributor

In an effort to make our Change Request Default view more user friendly, the Change Process Manager wants the Related list tabs to be highlighted in some way (different font color or different background color or bold font) when they aren't empty. We realize they already display a record count when they aren't empty, but want something more eye-catching. And we know they can be hidden when empty, but we need them to not be hidden so related records can be added. Does anyone know a way to do this that won't deviate too far from OOB and become a maintenance nightmare?

Thanks for the help, Reed

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

Following link should help

 

https://community.servicenow.com/community?id=community_question&sys_id=14fb0325db9cdbc01dcaf3231f96...


Please mark this response as correct or helpful if it assisted you with your question.

Thanks for the information. And the script does work to indiscriminately change the tab color. I only want to change the tab color for related lists that are not empty. So the missing piece is: How check which tabs have records? I did some trial-and-error and haven't yet found a way to do it.

Thanks.

Chavan AP
Kilo Sage

You can achieve this by writing a on load client script on your table:

 

 

 

Script:

 

function onLoad() {

 

    //Type appropriate comment here, and begin script below

 

var tabs = document.getElementsByClassName('tabs2_tab');

 

tabs[0].style.backgroundColor = 'red';

 

tabs[1].style.backgroundColor = 'green';

 

tabs[2].style.backgroundColor = 'orange';

 

tabs[3].style.backgroundColor = 'blue';

 

tabs[4].style.backgroundColor = 'yellow';

 

 

 

}

 

 

 

section numbers starts from 0. Replace the tab number with your required number to add color to that particular tab/section.

 

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

qz8437
Mega Contributor

Thanks for the information. And the script does work to indiscriminately change the tab color. I only want to change the tab color for related lists that are not empty. So the missing piece is: How check which tabs have records? I did some trial-and-error and haven't yet found a way to do it.

Thanks.