AnsweredAssumed Answered

calls relationship not created (bug?)

Question asked by Brad Foster on Mar 29, 2017
Latest reply on Apr 3, 2017 by Brad Foster

I think there is a bug in Enterprise 7.8 - probably other versions where the calls_contacts relationship is not created.


If you create a call via the subpanel from a contact, then it does link it correctly and you can see the call appear in calls_contacts table.

BUT if you change the parent from inside the call record, or create a call directly then it does not create the relationship entry in calls_contacts. (it only populates the parent_id in the calls table). So it doesn't create the required subpanel entry. Also, changing the assigned user does not remove the old user in the calls_users table.


I am getting around this by creating the link manually in a before_save logic hook.

$db->query("delete from calls_contacts where call_id = '{$bean->id}'");
$db->query("delete from calls_leads where call_id = '{$bean->id}'");
$db->query("delete from calls_users where call_id = '{$bean->id}'");

if ($bean->load_relationship('contacts')&&$bean->parent_type=="Contacts") {
if ($bean->load_relationship('leads')&&$bean->parent_type=="Leads") {