There is no normal complete updated documentation and API 2.0 examples; now it is almost impossible to find the necessary answers. Therefore I will ask here.
It is necessary that when the button is pressed, the completed call is registered with auto-completion of fields, based on the available data.
We have already written a script that registers calls, but it does not list their activity-related lists of the module. That's what we did.
- contactDetails = zoho.crm.getRecordById("Contacts",contact_id.toLong());
- firstName = ifnull(contactDetails.get("First_Name"),"");
- lastName = ifnull(contactDetails.get("Last_Name"),"");
- contact_name = firstName + " " + lastName;
- owner_id = contactDetails.get("Owner").get("id");
- ctTime = zoho.currenttime.toString("yyyy-MM-dd'T'HH:mm:ss'+03:00'");
- out_call_log_obj = Map();
- out_call_log_obj.put("Subject","Вызов:" + " " + "⧀" + " " + contact_name);
- out_call_log_obj.put("Owner",owner_id);
- out_call_log_obj.put("Who_ID",contact_id.toLong());
- out_call_log_obj.put("Call_Type","Исходящий");
- out_call_log_obj.put("$se_module","Contacts");
- out_call_log_obj.put("Call_Start_Time",ctTime);
- out_call_log_obj.put("Call_Duration","5:00");
- out_call_log_obj.put("Who_id",contact_id.toLong());
- out_call_log_obj.put("$which_call","CompletedСall");
- add_out_resp = zoho.crm.create("Calls",out_call_log_obj);
- update_out_resp = zoho.crm.update("Contacts",contact_id.toLong(),contactDetails);
- info add_out_resp;
- info update_out_resp;
- return "Исходящий вызов добавлен успешно!";
How should I add a script so that calls are added to the list of activities associated with contacts?
Also interested in tasks and events.