The CreatorCon Call for Content is officially open! Get started here.

Highlight VIP Users

john_roberts
Mega Guru

A customer recently asked for a better way to quickly identify VIP users from the incident form without having to add the VIP field to the form. She wanted to somehow apply a style to the caller label or field. I couldn't figure out how to use 'Personalize Styles' based on other field values so I used a client script. Since onChange events are fired onLoad this works when opening an existing incident as well.

There's an example of modifying the label and value styles.

New incident client script, onChange of caller.



function onChange(control, oldValue, newValue, isLoading) {

//wait until there is a valid record in the field
if (newValue) {

//get the caller object so we can access fields
var caller = g_form.getReference('caller_id');

//check for VIP status
if (caller.vip=='true') {

//change the caller label to red background
//style object is CSSStyleDeclaration so style names are not standard css names
document.getElementById('label.incident.caller_id').style.backgroundColor='red';

//change the caller's name field to red text
document.getElementById('sys_display.incident.caller_id').style.color='red';
}
else {
//not a VIP, remove temporary styles
document.getElementById('label.incident.caller_id').style.backgroundColor='';
document.getElementById('sys_display.incident.caller_id').style.color='';
}
}
}
Great idea, thanks Amie.

5 REPLIES 5

Dan Tolgyesi1
Tera Expert

Hi,

I am also interested in doing this, do you know if there is anyway of having the logo still in the script as well as thee background colour?

Thanks
Dan