How to highlight requestor name in red color if VIP is true and adding the vip icon on the top bar?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 12:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 12:22 AM - edited 06-10-2024 12:23 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 12:44 AM
not working in service operation workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 12:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 12:28 AM
@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.