如何通过在get_entry_list API调用的查询参数中提供电子邮件来获取列表


How do I get a list by supplying an email in the query parameter of the get_entry_list API call?

我正在尝试更新Sugar CRM中的特定Lead。我不知道这个潜在客户的ID,所以我试图通过使用电子邮件地址或名称调用get_entry_list来检索潜在客户ID。我想使用查询并指定一个电子邮件地址或类似的名称:

    'query' => "first_name = '"Bob'"",

我甚至尝试过:

    'query' => "first_name LIKE '"%Bob%'"",

    'query' => "email1 LIKE '"%bob@abc.com'"",

但我得到的结果是:

Database failure. Please refer to sugarcrm.log for details.

并且sugarcrm内部没有任何内容。log:(


这是完整的代码:

$get_entry_list_parameters = array(
//session id
'session' => $session_id,
//The name of the module from which to retrieve records
'module_name' => 'Leads',
//The SQL WHERE clause without the word "where".
'query' => "first_name = '"Bob'"",
//The SQL ORDER BY clause without the phrase "order by".
'order_by' => "",
//The record offset from which to start.
'offset' => '0',
//Optional. A list of fields to include in the results.
'select_fields' => array(
    'id',
    'name',
    'email1',
),
'link_name_to_fields_array' => array(
),
//The maximum number of results to return.
'max_results' => '10',
//To exclude deleted records
'deleted' => '0',
//If only records marked as favorites should be returned.
'Favorites' => false,
);
$get_entry_list_result = call('get_entry_list', $get_entry_list_parameters, $url);
echo '<pre>';
print_r($get_entry_list_result);
echo '</pre>';

编辑:我使用v4_1 REST API

将其作为一个运行示例进行检查>http://urdhva-tech.blogspot.in/2013/02/rest-api-example.html

希望你觉得它有用。

否则,通过查看$get_entry_list_parameters数组,它看起来应该可以正常工作。

查看第78行开始的service/v4/SugarWebServiceUtilv4.php。在那里设置断点或记录生成的查询($where)。也许这有助于你找出原因。