createCustomer
These functions enable the users to update customer records.
Description
vcc.updateCustomer(recordid, {"value", variable})
Updates a customer record in the project with the given data
Parameters
recordid
(integer) The record ID to be updates
variable
(variable) The variable to be used in the function
value
(string) The name of the field for the given record 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.