How to move the VIP Icon inside the caller field

Girish Nagaraj
Tera Contributor

Hi All,

 

I would like to display the VIP Icon inside the caller field. I was able to update this in sys_user table using the styles however this is not working in Incident form.

I would like the VIP image to show up as below

GirishNagaraj_0-1672745500675.png

 

Below is the field style :

GirishNagaraj_1-1672745500651.png

 

 

below is the client script. If I try the bgposition greater than 100% it gets hidden

 

function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.incident.caller_id');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;

if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('caller_id', vipCallerCallback);
}

function vipCallerCallback(caller) {
var callerLabel = $('label.incident.caller_id').down('label');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;

//check for VIP status
if (caller.u_vip == "vip") {
var bgPosition = "100% 100%";
if (document.documentElement.getAttribute('data-doctype') == 'true')
bgPosition = "100% 100%";

callerLabel.setStyle({backgroundImage: "url('6.png')", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingright: '20px' });
callerField.setStyle({color: "red"});


} else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}

1 REPLY 1

Hardik2109
Tera Guru

Hi,

Create a Client Script  and Upload the required icon image to System UI -> Images

Write down below code under script.

if (caller.vip == ‘true’) {
callerLabel.setStyle({backgroundImage: “url(images/icons/vip.gif)”, backgroundRepeat: “no-repeat”, backgroundPosition: bgPosition, paddingLeft: ‘30px’ });
}


Hit thumbs up if you feel that it was helpful in resolving your query.

 

Regards,