CRM - Change Agent State from Wrapup to Ready
Note: We strongly recommend using the method described here instead of the method below.
Step 1. Set the following script at [tenant] > [Script] on Brekeke CRM
Sample: agentview
Agent status is automatically changed to “Ready” just 10 sec past after the agent status becomes “Wrapup”.
var init = function(){
//registed once
if(window.crm_customer_func_registed){
return;
}
window.crm_customer_func_registed = true;
var agentWidget = Brekeke.CTI.DCIWorkView.getAppSpace();
var TIMEOUT_WRAPUP = 10 * 1000;//10 sec
var intervalId = null;
var onAgentStateChanged = function(ev){
if(ev.agentState == Brekeke.CTI.DCIWorkView.Constants.AGENT_STATE_WRAPUP){
//change to ready after 10 sec when wrapup until success
intervalId = setInterval( function(){
//set value to view items for successfully commit contact result
var result = Brekeke.UI.View.contact.fields.result;
result.setValue('Sale');
var info = agentWidget.getAgentInfo();
agentWidget.operate(Brekeke.CTI.DCIWorkView.Constants.manageAgentState,
{agentId:info.agentId,agentState:Brekeke.CTI.DCIWorkView.Constants.AGENT_STATE_READY,agentStateReason:'by myself'},"");
}, TIMEOUT_WRAPUP );
} else {
//stop loop because task completed
if(intervalId){
clearInterval(intervalId);
intervalId = null;
}
}
}
//regist event handle
agentWidget.addEventListener(Brekeke.CTI.DCIWorkView.Constants.agentStateChanged,onAgentStateChanged);
}
Step 2. Set the script function.
At [Advanced Settings] on the [Project Screen] page of the project or workspace on Brekeke CRM, set the script to be called when the agent status is changed.