Reputation: 865
I'm trying to update a specific Lead from Sugar CRM. I do not know the ID of this lead, so I'm trying to retrieve the lead ID by calling get_entry_list using email addresses or names. I wanted to use a query and specify an email address or a name like so:
'query' => "first_name = \"Bob\"",
I even tried:
'query' => "first_name LIKE \"%Bob%\"",
and
'query' => "email1 LIKE \"%[email protected]\"",
But I just get this result:
Database failure. Please refer to sugarcrm.log for details.
...and there's nothing inside sugarcrm.log :(
Here's the full code:
$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>';
EDIT: I'm using v4_1 REST API
Upvotes: 0
Views: 1222
Reputation: 906
Take a look in service/v4/SugarWebServiceUtilv4.php beginning in line 78. Set a breakpoint there or log the query ($where) that was generated. Maybe this helps you find out the reason.
Upvotes: 1
Reputation: 196
Check this a running example > http://urdhva-tech.blogspot.in/2013/02/rest-api-example.html
Hope you find it useful.
Else by looking at the $get_entry_list_parameters array, it looks like it should work just fine.
Upvotes: 1