AnsweredAssumed Answered

Remove relationship between case and email

Question asked by Autchara Chaiprom on Nov 20, 2017


I try to remove relationship between case and email via logic hook 3 ways but not working.

// Email logic hook
// 1
$bean->cases->delete($bean->id, $case_id);

// 2
$c = BeanFactory::newBean('Cases');
$c->emails->delete($case_id, $bean->id);

// 3
$sql = "UPDATE emails_beans SET deleted = 1 WHERE bean_id = '{$case_id}' AND email_id = '{$bean->id}'";

I found that relationship store in emails_beans table and also in emails in parent_id fields.


In my problem is there are no relationship store in both place but I still can saw an email in a case.

I guess that I might missing deleted a relationship in some place or some weird part of code.


Do you have any idea from this problem?

SugarPro 7.8