Simple JS codes
Check mandatory field in before disposition set
$().beforeSetDisposition = function(disposition) {
if (disposition.id == 11 && !vcc.getFieldValue("fieldName"))
{
alert('This field is mandatory!');
return false;
}
};
Transfer a call to an inbound process
$('oldal_name.button_name').afterSetData = function() {
vcc.transfer('processid', true);
};
Transfer a call to a phone number
$('page', 'transfer_phone_button').afterSetData = function() {
vcc.transfer('3670333444');
};
Complex JS codes
Pinning the operators name into a text field
$('adatlap').onLoad = function() {
var operatorUsername;
var operatorUsername = vcc.getScriptVariable('agent.name');
var operators = vcc.getFieldValues('agent_help');
operators.forEach(function(item) {
if (item.label === operatorUsername) {
vcc.setFieldValue('agent_name', item.label);
vcc.setFieldValue('agent_id', item.export_value);
}
});
};
Sending an HTTP (AJAX) request
// Get required informations on page onload event using AJAX
$('sample_page').onLoad = function() {
// Create a request object to handle connection
var request = vcc.httpRequest();
// We want to send a request to the following url
request.open('GET', 'http://www.google.com/robots.txt');
// JavaScript is asynchronous, so we have to define
// the onload callback before sending the request
request.onload = function(e) {
// just dumps the result to the console (your code goes here)
dump(request.responseText);
};
// Send the HTTP request to the URL specified above
request.send();
};
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.