Drop email address of a bean

sugarcrmdevelopers —  May 14, 2013 — 1 Comment

I came across this question on the forums not too long back…

is there anyway in sugar to drop the email addresses of a bean(Contacts)?
so far i know it is possible to add some email address to a bean, i would like to drop them all.

So I went to the community to help get an answer, which they responded to well…

And here’s what Cedric came back with…

$contactId = 'xxx-xx-xxxx-xxx';
$contact = BeanFactory::getBean('Contacts', $contactId);
$contact->emailAddress->addresses = array();
$contact->emailAddress->save($contact->id, $contact->module_dir);

Thanks Cedric for the solution!

Trackbacks and Pingbacks:

  1. Setting the primary email address via REST api - June 5, 2013

    […] […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s