Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Hi,

you want to highlight on behalf of field when caller changes right?

Regards
Ankur

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

Yes Ankur, same as caller field highlights for VIP User.

@madhuri229@gmail 

Did you check any browser console error is coming?

Also did you check by adding alert etc in client script

Regards
Ankur

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