AnsweredAssumed Answered

How to extract contacts where email_opt_out = 0 using SOAP API?

Question asked by Janine Stewart on Dec 8, 2014
Latest reply on Dec 9, 2014 by Janine Stewart
We are trying to create an extract of Contacts where the email address not null and is opted in i.e. email_opt_out = 0 and the record has been modified in the last day.

The only way we have found to do this is with the following IN query: IN (SELECT bean_id FROM email_addr_bean_rel INNER JOIN email_addresses WHERE email_addr_bean_rel.email_address_id = AND bean_module = 'Contacts' AND email_addresses.email_address IS NOT NULL AND email_addresses.opt_out = 0) AND DATEDIFF(contacts.date_modified, DATE_SUB(CURDATE(), INTERVAL 1 DAY)) BETWEEN 0 AND 1

With masses of contacts, an IN query is not very efficient and could take a long time to execute. Is there a more efficient way to query Sugar to get the same result?

We are using Sugar Professional Version 6.5.5 (Build 8525), SOAP API 4.1