SugarCRM: How to retrieve complex SQL statements with sugar internal functions? -
in order retrieve contact, having cell phone number of 09362724853
, use following code:
$newsms_contact = new contact; $newsms_contact->retrieve_by_string_fields(array('phone_mobile'=>'09362724853'));
how retrieving contact having cell phone number of 09362724853
or 9362724853
or +989362724853
sugar internal functions?
this doesn't work:
$newsms_contact = new contact; $newsms_contact->retrieve_by_string_fields(array('phone_mobile'=>'09362724853', 'phone_mobile'=>'9362724853', 'phone_mobile'=>'+989362724853'));
the thing function trying utilize created other goals. since fetches 1 row db , fills bean it, array of parameters turned string separated and operators. have different case.
i suggest use approach, less convenient more reliable:
$contact_bean = new contact(); $contacts_list = $contact_bean->get_full_list(null, '(phone_mobile = "09362724853" or phone_mobile = "9362724853" or phone_mobile = "+989362724853")');
eventually, have array of beans. probably, modules, need use table aliases fields definition sql supplement.
Comments
Post a Comment