Highlight VIP caller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 08:55 AM
Hi Everyone,
As we know, that we have an OOB feature called "Highlight VIP Employee" used in incident form or hr case forms. We have a requirement to have the same functionality which is - " In the list view have VIP icon/image beside the opened_by field on chat records.(This i was able to achieve, by assigning a new style to it and it worked). When i open a chat record i want to highlight the person's name in the "opened_by" field to "Red color" as we see on the incident or hr case forms. I have applied a client script -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
g_form.getReference('opened_by',setColor);
}
function setColor(openedby) {
var openedbyField = g_form.getElement('sys_display.' + g_form.getTableName() + '.opened_by');
if (openedby.vip == 'true')
openedbyField.setStyle({color : "red"});
else
openedbyField.setStyle({color : ""});
}
But its not working. Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 09:44 AM
Thanks for your concern.
Here is the script i have included as per your suggestion but still no luck -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var callerLabel = $('label.opened_by');
var callerField = $('sys_display.opened_by');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('opened_by', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.opened_by').down('label');
var callerField = $('sys_display.opened_by');
if (!callerLabel || !callerField)
return;
//check for VIP status
if (opened_by.vip == 'true') {
var bgPosition = "95% 55%";
if (document.documentElement.getAttribute('data-doctype') == 'true')
bgPosition = "5% 45%";
callerLabel.setStyle({backgroundImage: "url(vip_user.png)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
} else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}
Am i doing anything wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 12:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 12:43 PM
Yes it is opened by
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 12:54 PM
On which table you are trying to execute the code?
Regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 12:59 PM
It;s chat records
table - chat_queue_entry