使用 Deluge 功能重定向到 Zoho 匹配的客户记录
Redirect to Zoho matched Customer Record with Deluge function
我正在尝试通过 iframe 将 Zoho CRM 嵌入到只知道 phone 号码的应用程序中。
(漫谈:最初我打算调用 Zoho api 通过 phone 号码查找联系人并重定向或加载联系人的 Zoho 页面 - 但托管应用程序似乎没有支持足够的功能来适应 Zoho 的 OAuth2-only 身份验证 - 所以我认为我坚持使用 Zoho Deluge,我发现它是一种残忍的语言)
我希望使用 phone 号码作为参数 GET 导航到此 Zoho 函数,让它找到唯一的匹配项,然后重定向到客户详细信息。
response = zoho.crm.searchRecords(
"Contacts",
"", // no criteria - I hope the later parameter
// normalizes better than this would?
1, // first page
2, // of two max results - just to verify uniqueness
"{ phone: '" + phoneNumber + "'}"); // Docs are terrible. Is this the format?
// I also tried "phone:equal:..."
//if (1 < response.size()) { // script errors show up on nonsense line
// return "[Ambiguous]"; // numbers, but this seems to work until later
//} // lines are included - then errors point here
return response; // Works, but useless string output
return response.firstName; // "Invalid collection object found" - but not expected to work
return response.get(0); // 'TEXT' can not be cast to '[KEY-VALUE, TEXT, LIST]' for the function 'get'
return response.get('firstName'); // 'TEXT' can not be cast to '[KEY-VALUE, TEXT, LIST]' for the function 'get'
return response.get(0).firstName; // Improper Statement Error might be due to missing ';' at end of the line or incomplete expression
// openUrl( <string>, <window_type> ); // hoping to get here
我也试过从 for each element 循环内部返回的变体,没有成功。
我认为我已经通过 phone 号码成功找到了用户,因为我认为我确实找到了一个匹配项,但我无法验证它并且我不知道如何推导出 url openUrl() 调用的客户详细信息页面。你知道如何在这方面取得进展吗?
criteria 格式错误,函数 searchRecords returns 地图列表。
要访问所有列表的第一个元素,您必须使用 .get(0) 并获取地图的一个元素 .get("First_Name")
字段格式不正确,必须获取API字段形式的名称 crm.zoho.com->setup->API->API names->Contacts
您可以使用info调试响应(info response;)
toReturn = "";
response = zoho.crm.searchRecords("Contacts", "Phone:equals:" + phoneNumber, 1, 2);
if (1 < response.size()) {
toReturn = "[Ambiguous]";
} else if (0 == response.size()) {//error triggered if use get(0) of emty list
toReturn = "[None]";
}else {
toReturn = reponse.get(0).get("First_Name");
openUrl("https://crm.zoho.com/crm/org[yourOrgID]/tab/Contacts/" + reponse.get(0).get("id"), "new window");
}
return toReturn;
我正在尝试通过 iframe 将 Zoho CRM 嵌入到只知道 phone 号码的应用程序中。
(漫谈:最初我打算调用 Zoho api 通过 phone 号码查找联系人并重定向或加载联系人的 Zoho 页面 - 但托管应用程序似乎没有支持足够的功能来适应 Zoho 的 OAuth2-only 身份验证 - 所以我认为我坚持使用 Zoho Deluge,我发现它是一种残忍的语言)
我希望使用 phone 号码作为参数 GET 导航到此 Zoho 函数,让它找到唯一的匹配项,然后重定向到客户详细信息。
response = zoho.crm.searchRecords(
"Contacts",
"", // no criteria - I hope the later parameter
// normalizes better than this would?
1, // first page
2, // of two max results - just to verify uniqueness
"{ phone: '" + phoneNumber + "'}"); // Docs are terrible. Is this the format?
// I also tried "phone:equal:..."
//if (1 < response.size()) { // script errors show up on nonsense line
// return "[Ambiguous]"; // numbers, but this seems to work until later
//} // lines are included - then errors point here
return response; // Works, but useless string output
return response.firstName; // "Invalid collection object found" - but not expected to work
return response.get(0); // 'TEXT' can not be cast to '[KEY-VALUE, TEXT, LIST]' for the function 'get'
return response.get('firstName'); // 'TEXT' can not be cast to '[KEY-VALUE, TEXT, LIST]' for the function 'get'
return response.get(0).firstName; // Improper Statement Error might be due to missing ';' at end of the line or incomplete expression
// openUrl( <string>, <window_type> ); // hoping to get here
我也试过从 for each element 循环内部返回的变体,没有成功。
我认为我已经通过 phone 号码成功找到了用户,因为我认为我确实找到了一个匹配项,但我无法验证它并且我不知道如何推导出 url openUrl() 调用的客户详细信息页面。你知道如何在这方面取得进展吗?
criteria 格式错误,函数 searchRecords returns 地图列表。
要访问所有列表的第一个元素,您必须使用 .get(0) 并获取地图的一个元素 .get("First_Name")
字段格式不正确,必须获取API字段形式的名称 crm.zoho.com->setup->API->API names->Contacts
您可以使用info调试响应(info response;)
toReturn = "";
response = zoho.crm.searchRecords("Contacts", "Phone:equals:" + phoneNumber, 1, 2);
if (1 < response.size()) {
toReturn = "[Ambiguous]";
} else if (0 == response.size()) {//error triggered if use get(0) of emty list
toReturn = "[None]";
}else {
toReturn = reponse.get(0).get("First_Name");
openUrl("https://crm.zoho.com/crm/org[yourOrgID]/tab/Contacts/" + reponse.get(0).get("id"), "new window");
}
return toReturn;