AnsweredAssumed Answered

Get collection of contacts by email

Question asked by marc.ward@xbrl.us on Oct 21, 2015
Latest reply on Jun 1, 2016 by Mike Searcy
Hello, I'm new with SugarCRM and am writing some code while figuring out how the system works.  I'm using on-demand, version 7.6.

What I want to do is grab a collection of contact records filtered by the email field in Studio, then iterate through those to check if they have an account associated with them.  Since an email field is available in Studio by default I thought it'd be easy to access it like this:

$contactsBean = BeanFactory::getBean('Contacts');
$contacts = $contactsBean->get_full_list('','contacts.email like \'%' . $bean->fetched_row['email_domain_c'] . '\'');

Then I found out that field actually isn't in the contact record.  I've seen a couple examples for pulling primary email records but I couldn't find any real documentation about it.  

1) Is there a way to pull a collection using the module layouts as defined in Studio?  ($bean->retrieve_by_string_fields() works fine but is limited to the first record)  How can I perform this task?
2) Is there comprehensive documentation for all the Bean methods and functions?  I can only find a few methods/fuctions in the documentation but see so much more in external examples I happen across.

Outcomes