Thank you for your input!
I’ve tried digging deeper, and I’ve found out that the History
subpanel that I thought shows linked emails, actually shows both linked and unlinked.
Here’s what I’ve found:
In modules/Leads/metadata/subpaneldefs.php
this is the part regarding History
subpanel:
'history' => array(
// ...
'collection_list' => array(
'meetings' => array(
// ...
),
'tasks' => array(
// ...
),
'calls' => array(
// ...
),
// ... skipping for brevity
'emails' => array(
'module' => 'Emails',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'emails',
),
'linkedemails' => array(
'module' => 'Emails',
'subpanel_name' => 'ForUnlinkedEmailHistory',
'get_subpanel_data' => 'function:get_unlinked_email_query',
'generate_select' => true,
'function_parameters' => array('return_as_array' => 'true'),
),
),
// ...
And here’s the SQL statement from function:get_unlinked_email_query
from include/utils.php
:
$return_array['select'] = 'SELECT emails.id ';
$return_array['from'] = 'FROM emails ';
$return_array['where'] = '';
$return_array['join'] = " JOIN (select DISTINCT email_id from emails_email_addr_rel eear
join email_addr_bean_rel eabr on eabr.bean_id ='$bean->id' and eabr.bean_module = '$bean->module_dir' and
eabr.email_address_id = eear.email_address_id and eabr.deleted=0
where eear.deleted=0 and eear.email_id not in
(select eb.email_id from emails_beans eb where eb.bean_module ='$bean->module_dir' and eb.bean_id = '$bean->id')
) derivedemails on derivedemails.email_id = emails.id";
which as I undertand it returns all emails for the specific lead except for the linked emails.
So that means that imported emails are not being linked to my Leads in any way, not one-way, not any another way, unless I manually link them and/or directly send emails to my leads from within SuiteCRM.
I want the emails to be automatically linked to my Leads and vice-versa. Not sure how I should proceed.
Any tips are greatly appreciated!