searchCustomer
These functions enable the users to search for customer records
Description
vcc.searchCustomer("value", variable)
Searches a customer record in the project based on the given variables. The search is performed in the given project.
Parameters
variable
(variable) The variable to be used in the function
value
(string) The name of the field for the given record is used for searching or updating.
Return values
none
Example
function saveCustomerAndAssignChat(ctx){
var clientid = vcc.getVariable('clientid');
var records = vcc.searchCustomer("clientid", clientid);
if (records && records.rows.length > 0){
vcc.updateCustomer(records.rows[0].id, {"clientid": clientid})
vcc.assignCustomer(records.rows[0].id,0);
return;
}
var newCustomerId = vcc.createCustomer([{
"form": {
"clientid": clientid
};
}])
if (newCustomerId !=0){
vcc.assignCustomer(newCustomerId,0);
}
}
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.