How to check if an entry exists in SugarCRM module
SugarCRM is a model for managing a company’s interactions with customers. Sugar on Drupal module can be used for integrating SugarCRM with Drupal. SugarCRM stores the customer information in modular format. Before passing customer details to SugarCRM, if you want to check whether the entry already exists in sugarCRM then read on .
For checking if the entry already exists sugar on drupal's sugarondrupal_get_entry_list() function can be used.For example if you want to check if an entry with "abc.example.com" already exists in SugarCRM's "User" module then refer the gollowing code.
$user_exists = sugarondrupal_get_entry_list(array( 'module_name' => 'User', 'query' => "email1 = '" . $email . "'", 'offset' => 0, 'deleted' => 0, 'max_results' => 10, ));
Here the function queries the field value pair specified in 'query' and returns the count of the fields matching the condition. $user_exists['result_count'] will return 0 if no matching cases are found.