请帮助我如何创建自定义功能以从 zoho crm 中的自定义模块搜索记录。
我是 zoho crm 新手,所以我不知道如何为此编码。 工作流程在事件创建时触发。
在自定义模块中,LEADID 被插入到潜在客户 ID 字段中,我想通过自定义模块中的潜在客户 ID 字段值搜索记录。 在函数中,我传递了搜索记录的引导 ID。 下面是我创建的示例代码,但它不起作用。
Lead_id=input.LeadID.toString();
Event_id=input.EventID.toString();
rec = zoho.crm.getRecordById("Events",input.EventID);
resp = zoho.crm.searchRecords("CustomModule1","Lead Id",input.LeadID);
for each ele in resp
{
mp=map();
mp.put("Event Created Time",rec.get("Created Time"));
contactId=ele.get("CUSTOMMODULE1_ID");
updateResp = zoho.crm.updateRecord("CustomModule1",contactId,mp);
}
这里是使用 PHP 的示例 API 方法,使用 Lead ID 从 Lead 模块获取记录的代码
$auth = "*************************";// Auth Keys
$id="****************";// Record Id
////////////get data by Id from Zoho Lead Module ///////////
$get_url = "https://crm.zoho.com/crm/private/json/Leads/getRecordById?";
$get_query = "authtoken=".$auth."&scope=crmapi&id=".$id."";
$get_curl = curl_init();
curl_setopt($get_curl, CURLOPT_URL, $get_url);
curl_setopt($get_curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($get_curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($get_curl, CURLOPT_TIMEOUT, 60);
curl_setopt($get_curl, CURLOPT_POST, 1);
curl_setopt($get_curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($get_curl, CURLOPT_POSTFIELDS, $get_query);
$get_response = curl_exec($get_curl);
$jfo = json_decode($get_response);
echo "<pre>";
curl_close($get_curl);
print_r($jfo);
而不是
resp = zoho.crm.searchRecords("CustomModule1","Lead Id",input.LeadID);
使用
resp = zoho.crm.searchRecords("MODULE","(FIELD:equals:" + LeadID + ")");
对于“CustomModule1”和“Lead Id”,请检查 API 名称部分以确认它们实际的名称。
**Check **"Lead Id" field API name**** :- Navigate to Zoho CRM Setting-> Developer Hub->select APIs and SDKs -> API Names -> select your module in which you have this "lead Id" field.
**Note** :replace "FIELD" and "Event Created Time" to its api name.
Please find the below Code:-
Lead_id=input.LeadID.toString();
Event_id=input.EventID.toString();
rec = zoho.crm.getRecordById("Events",input.EventID);
resp = zoho.crm.searchRecords("CustomModule1","(FIELD:equals:" + Lead_id + ")");
if(resp.size() > 0)
{
for each ele in resp
{
mp=map();
mp.put("Event Created Time",ifnull(rec.get("Created Time"),""));
contactId=ifnull(ele.get("CUSTOMMODULE1_ID"),"");
updateResp = zoho.crm.updateRecord("CustomModule1",contactId,mp);
}
}