VIP Flag Visibility

madhuri229
Tera Contributor

Hi All,

 

Currently the VIP flag only shows when the VIP is in the “Caller” field, but often raised on behalf of a VIP, so needs to show as a flag on both “Caller” and “On Behalf Of”.

I have checked client script Highlight VIP caller and created similar one for on behalf of with some changes in it. But it is not working . Could you please help here with suggestions.

 

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

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

function vipCallerCallback(caller) {
var callerLabel = $('label.incident.u_on_behalf_of').down('label');
var callerField = $('sys_display.incident.u_on_behalf_of');
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(images/icons/vip.gif)",
backgroundRepeat: "no-repeat",
backgroundPosition: bgPosition,
paddingLeft: '30px'
});
callerField.setStyle({
color: "red"
});
} else {
callerLabel.setStyle({
backgroundImage: ""
});
callerField.setStyle({
color: ""
});
}
}

 

Regards,

Madhuri

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Did you set Isolate Script field as false for your new client script?

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

 

Currently it is showing as true. What does this mean?

 

Hi,

When it is false it would allow DOM manipulation

the client script uses DOM manipulation to show the color etc

$ -> means DOM is used

Try to set it false and then re-test

var callerLabel = $('label.incident.u_on_behalf_of');
var callerField = $('sys_display.incident.u_on_behalf_of');

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

I have made it false. Still it is not working . Not highlighting VIP user for on behalf of field. Any other suggetions please.

 

Thanks.