How to highlight requestor name in red color if VIP is true and adding the vip icon on the top bar?

alt
Tera Contributor

AngelynTumbaga_0-1718003060852.png

 

7 REPLIES 7

Jitendra Diwak1
Kilo Sage

Hi @alt,

 

Please try this below code in onChange client script:

 

var caller = g_form.getReference('caller_id',callback);
function callback(caller){
if(caller.vip == 'true'){
var labelcolor = document.getElementById('label.incident.caller_id');
labelcolor.style.color = 'red';
}
}

 

 

Please accept my solution if it works for you and thumps up.

 

Thanks

Jitendra

Please accept my solution if it works for and thumps up.

not working in service operation workspace

Hi @alt,

 

Please try this code

 

// Define the client script to be triggered onchange of the field

function onChangeScript() {

    // Get the value of the field

    var fieldValue = g_form.getValue('your_field_name'); // Replace 'your_field_name' with the actual field name

    

    // Check if the field value meets a certain condition

    if (fieldValue === 'desired_value') { // Replace 'desired_value' with the value that triggers the color change

        // Change the text color of the field

        g_form.setDisplay('your_field_name', false, '#FF0000'); // Replace 'your_field_name' with the actual field name and '#FF0000' with the desired color code

    } else {

        // Reset the text color if the condition is not met

        g_form.setDisplay('your_field_name', true, ''); // Replace 'your_field_name' with the actual field name

    }

}

 

Please accept my solution if it resolves your issue and thumps 👍 up

Thanks

Jitendra 

Please accept my solution if it works for and thumps up.

Mohan Mallapu
Kilo Sage

@alt  

You can find the solution here : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0794200

Please accept my solution if it works for you and thumps up.