Examples

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();
};

There are no comments yet.

Comment

Subscribe to our newsletter
or Contact us!
Please note that by subscribing to our newsletter, you agree to receive regular email messages from VCC Live about service related news and updates. By subscribing to our newsletter, you also agree that VCC Live will use your data in accordance with the applicable Privacy Policy until you unsubscribe from the newsletter.