Highlight VIP Users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2007 06:46 PM
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.
Great idea, thanks Amie.
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='';
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2007 12:06 PM
How would you change this script to allow it to just look for the caller NOT look for a change to the caller. So if the Caller is set to a person it will auto flag it as a VIP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2007 01:03 PM
Tannia,
Not sure if I follow your requirement. The onChange event will also run with you load the incident form with a user already populated even though the user field is not changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2008 12:40 PM
This doesn't seem to be working for me. I have added the VIP field to the Users form and set one of the Users, ITIL_TEST, as a VIP. I have then created a new client script called Highlight VIP and pasted the code. Finally, I opened an Incident and selected ITIL_TEST as the Caller, but the field was not highlighted in Red. I went back to the script and changed the Type from onChange to onLoad, to no avail. Have I missed a step?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2008 12:49 PM
Ignore my previous post, I was being dim. Sorted it out by adding 'Caller' to Field Name