|Posted by swapnil shinde on February 15, 2012 at 7:55 AM|
As Email for all the modules which are derived from Person Template/Type will be stored in Email Module. We can access this email by finding out relationship between module and email module.
Suppose you want to find Contact's email and you have its id(generated by sugar) then you can use following query to find out the email.
from email_addresses e, email_addr_bean_rel ec
where bean_id = '$contact_id'
and ec.email_address_id = e.id
and e.opt_out =0
and e.deleted =0
and ec.deleted =0"
Suppose you want to find out Account's or User's email you can just replace the contact id by account or user's id and get it.
Categories: Feb2012-SugarCRM Help