I can schedule calls without a problem for a lead using API. But when we try to cancel all the scheduled/overdue calls for a lead via API, it does not work. Here is our existing script:
void Closecalls(int moduleId)
{
relatedTask = zoho.crm.getRelatedRecords("Calls","Leads",moduleId);
for each record in relatedTask
{
call = record.toMap();
status = call.get("Call_Status");
info status;
if(status.equals("Scheduled") || status.equals("Overdue"))
{
reltaskid = call.get("id");
response = zoho.crm.updateRecord("Calls",reltaskid,{"Call_Status":"Cancelled"});
info response;
}
}
}
Here is the response I get (it looks like it updated something, but it definitely does not actually cancel the 2 Scheduled/Overdue Calls:
"Cancelled",
"Scheduled",
{
"Modified_Time": "2021-01-31T03:25:10-06:00",
"Modified_By": {
"name": "Mikhail Test", "id": 320103xxxxxxxxx
},
"Created_Time": "2021-01-31T03:13:16-06:00",
"id": 3201031xxxxxxxxxx,
"Created_By": {
"name": "Mikhail Test", "id": 3201xxxxxxxxxxx
}
},
"Overdue",
{
"Modified_Time": "2021-01-31T03:25:10-06:00",
"Modified_By": {
"name": "Mikhail Test",
"id": 3201xxxxxxxxxxxxx
},
"Created_Time": "2021-01-31T02:50:00-06:00",
"id": 32010xxxxxxxxxxxxxxx,
"Created_By": {
"name": "Mikhail Test",
"id": 3201xxxxxxxxxxxx
}
},
"Scheduled Unattended",
"Cancelled",
"Scheduled Unattended",
"Scheduled Unattended",
"Scheduled Unattended",
"Scheduled Unattended",
"Unattended Dialled"
]Please help us figure out how to cancel scheduled calls via API.