- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 03:24 PM
I'm trying to add a VIP flag (similar to the OOB flag on incident caller) to the "opened for" field on interactions. I'm trying to repurpose the same client script from incident (see below), but am receiving this error "onChange script error: TypeError: $ is not a function function () { [native code] }". Please let me know if there is a better way to go about doing this or any changes you would recommend to my script below, thank you in advance!
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.interaction.opened_for');
var callerField = $('sys_display.interaction.opened_for');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('opened_for', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.interaction.opened_for').down('label');
var callerField = $('sys_display.interaction.opened_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(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
} else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 04:13 PM
Hello marrerocmm,
Try to run this code:
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.interaction.opened_for');
var callerField = $('sys_display.interaction.opened_for');
if (!callerLabel || !callerField)
return;
g_form.getReference('opened_for', vipCallerCallbackINT);
}
function vipCallerCallbackINT(caller) {
var callerLabel = $('label.interaction.opened_for').down('label');
var callerField = $('sys_display.interaction.opened_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(images/icons/vip.gif)",
backgroundRepeat: "no-repeat",
backgroundPosition: bgPosition,
paddingLeft: '30px'
});
//set callerField color
callerField.setStyle({
color: "red"
});
} else {
callerLabel.setStyle({
backgroundImage: ""
});
callerField.setStyle({
color: ""
});
}
}
Please mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
It is working fine in the list view, but to configure the VIP flag in the list view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I mean to say it is working on the form view, but who to configure in the list view
