Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

VIP Caller with red font color (Incident Table)

Elton2
Tera Contributor

Hi everyone, how are you?!


Every time a VIP user opens an INC, it must have the “VIP” icon and the font color “Red” (img1).


Note that I have already defined the user “Enzo” as VIP (img2), but when I access the Incident record, the font color is not Red (img3).

 

There is the option to right-click on the “Caller” field > Configure Styles (img4) (img4.1), but even defining “color: red” or “color: red !important” does not work.

 

Note: I tried using a Client Script (Incident table), but it does not work (img5)

    function onLoad() {
        var vipCallerName = g_form.getValue('caller_id');
        if (g_form.getValue('caller_id.vip') == 'true') {
            vipCallerName.style.color = 'red';
        } else {
            vipCallerName.style.color = '';
        }
    }

 

Obs.:  I also found this tip in the Community but it doesn't work:

https://www.servicenow.com/community/itsm-forum/change-font-color-to-red-for-caller-with-a-true-vip-...

 

Does anyone have any tips? please!

 

Thanks 😉

 

2 ACCEPTED SOLUTIONS

Harish Bainsla
Kilo Patron
Kilo Patron

Hi @Elton2  check below script I try on pdi its working

function onLoad() {
//Type appropriate comment here, and begin script below
var caller = gForm.getReference('caller_id', function(caller) {
if (caller.vip == 'true') {
gForm.setDisplayValue('caller_id', caller.name + ' (VIP)');
// Apply red font
var fieldElem = document.getElementById('label.caller_id');
if (fieldElem) {
fieldElem.style.color = 'red';
fieldElem.style.fontWeight = 'bold';
}
}
});
}

View solution in original post

Hi @Elton2 

It appears to be an OOB feature where selecting a VIP user as the caller automatically changes the font color to red and displays the VIP logo in front of the field by default.

I recommend raising a HI ticket with the vendor.

 

Pic from fresh PDI.

Screenshot_20250622-184624.png

Regards,

Siva

View solution in original post

15 REPLIES 15

Hi @Elton2 you have written wrong  gForm.setDisplayValue('caller_id', caller.name + ' (VIP)'); instead of it correct with below line

 

g_form.setDisplayValue('caller_id', caller.name + ' (VIP)');

 

if my answer helps you mark helpful and accept solution 

Hi @Harish Bainsla , how are you?!

 

I wrote it right! 👍
I just wanted to know if there is a possibility of it turning "red" when the "caller_id" field is read-only.

 

Obs.: When I leave the field read only, the red color doesn't work (img6), the red color only works when the field is open, example (img6.1).

 

In addition to the code you wrote, I included this line of code, but them not work:

gForm.caller.setReadOnly or g_form.setReadOnly('caller_id', true);
 
function onLoad() {
    //Type appropriate comment here, and begin script below
    var caller = gForm.getReference('caller_id', function(caller) {
        if (caller.vip == 'true') {
            //g_form.setReadOnly('caller_id', true);
           // gForm.caller.setReadOnly;
            gForm.setDisplayValue('caller_id', caller.name + ' (VIP)');
            // Apply red font
            var fieldElem = document.getElementById('label.caller_id');
            if (fieldElem) {
                fieldElem.style.color = 'red';
                fieldElem.style.fontWeight = 'bold';
               
            }
        }
    });
 
Thanks again 👏

 

Hi @Elton2 I don’t think OB it is possible 

If you have another question ask in new question on community if my answer helps you accept solution 

Hi @Harish Bainsla 

I have no other questions! 
I'd like to thank you again for your support, I will "Accept Solution".

Thanks 😉