AnsweredAssumed Answered

Saving Contact $bean deletes email addresses

Question asked by Aroddo Aroddo on Oct 1, 2014
Latest reply on Feb 18, 2018 by Shijin Krishna
In the after_save logic hook for Accounts I wrote some code that would change the primary address of all Contacts linked to that account to the billing address of that account.

The code works, but we eventually noticed, the the mystery of vanishing email-addresses was directly related to that code I wrote:

foreach ($bean->contacts->getBeans() as $contact){
  $contact->primary_address_street = $bean->billing_address_street;

The intended changes appear, but all linked contacts lose their email addresses.

Any ideas on how to convince $contact->save() to indeed save everything?