AnsweredAssumed Answered

What functions run when you remove an account from a contact?

Question asked by Noah Hall on Sep 3, 2015
Latest reply on Sep 3, 2015 by Noah Hall
When you're on the contact's record page, and you remove the associated account, what function runs?

I'm trying to do this in a logic hook but it is not working.

The following code works for other relationships that are instances of Link2, but not the contact & account relationship:


//load the account relationship on this bean         
        $bean->load_relationship('accounts');

          //If the relationship was loaded correctly, lets do some magic
          if($bean->accounts->loadedSuccesfully()){

           #Remove beans based on ID
            if($old_accounts = $bean->accounts->get()){
            
        foreach ($old_accounts as $key => $value){
                 $bean->accounts->delete($bean->id);
                     $bean->save(false);

             }

if I change $bean->accounts to $bean->tasks it works,

Outcomes