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:09 AM
Hello Sid
Below is the script I have used for showing the STAR icon beside the VIP user and making the field display as red in color.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var callerLabel = $('label.sc_request.requested_for');
var callerField = $('sys_display.sc_request.requested_for');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('requested_for', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.sc_request.requested_for').down('label');
var callerField = $('sys_display.sc_request.requested_for');
if (!callerLabel || !callerField)
return;
//check for VIP status
if (caller.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: ""});
}
}
I think you have cut short this script, hope this helps for your requirement.
Please hit correct based on impact of response.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 09:26 AM
Hi Nitin,
Are you making changes on the requested_for field on the form to get the functionality?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 09:30 AM
In my case there is a field called "opened_by" on the chat record or form and i created a new style to that field to get the VIP icon beside the opened_by field on the list view. Here it is -
Style -
Table - chat_queue_entry
field - opened by
value - javascript:current.opened_by.vip == true
style - background-image: url('images/icons/vip.gif');
background-repeat: no-repeat;
background-position: 98% 5px;
padding-right: 30px;
Having this i am able to display the VIP icon only in the list view of the chat records. When i open the record i want to highlight the opened_by field in red color if the person is VIP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 09:41 AM
Hello Sid
Yes, in my case I'm making the requested_for field value to 'red' and trying to display STAR icon. You have to change that field name to 'opened_by' as per your requirement.
Also, you can't make the VIP field value to red in color and cannot display STAR icon beside to it just by using field styles. Earlier I was doing the same but it never worked and then I as per my research I understood we have to write a onChange() client script which I have updated the code part earlier.
Please try to create a onChange() client script on the table you want to do. This should take care of the Field color and STAR icon.
Please let me know in case of any questions.
Regards!