Hi,
So Iāve already customized the convert-lead page and it is working fine with the exception of email1
.
I understand that these fields are actually more complex behind the scenes and that email{1,2,3,n}
is a proxy for underlying email module relationship.
However it works fine with contact.
e.g. in custom/modules/Leads/metadata/convertdefs.php
, specifying āemail1ā under the Contact sectionā¦
Contact definition extract in convertdefs.php
$viewdefs['Contacts']['ConvertLead'] = array(
'copyData' => true,
'required' => true,
'select' => "report_to_name",
'default_action' => 'create',
'templateMeta' => array(
'form'=>array(
'hidden'=>array(
'<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
'<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
'<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
'<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
'<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
)
),
'maxColumns' => '2',
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30'),
),
),
'panels' =>array(
'LNK_NEW_CONTACT' => array(
array(
'last_name',
'email1',
),
)
),
);
ā¦works fine.
Trying the same thing with Account does NOT work
Account definition extract in convertdefs.php
$viewdefs['Accounts']['ConvertLead'] = array(
'copyData' => true,
'required' => true,
'select' => "account_name",
'default_action' => 'create',
'relationship' => 'accounts_contacts',
'templateMeta' => array(
'form'=>array(
'hidden'=>array(
'<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
'<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
'<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
'<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
'<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
)
),
'maxColumns' => '2',
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30'),
),
),
'panels' =>array(
'LNK_NEW_ACCOUNT' => array(
array(
'email1',
),
)
),
);
Iāve cleared the template cache (learned that last time). No errors. The convert form renders as expected with the email form in place for the Accountā¦but the value is not populated like it is for Contact.
There is also some weird bug where if you have email1
in both Contact and Account on the same page, the javascript (or php template) freaks out and you end up with a ton of extra email input lines and some other mangling.
Iāve tried keeping email1
in both Contact and Account as well as removing it from Contact (only in Account) on the convert lead page. No luck.
So I guess there is some hard-coded, Contact-specific āhackā somewhere that causes email1
to populate from Lead for Contact but not Account. Iāve spent about 4 hours reading through various modules, includes and the SugarEmailAddress.{js,php}
files as well as a fair bit of grepping trying to track down where this is happening.
There is a comment (modules/Leads/views/view.convertlead.php#L248) in the giant display()
function that indicates email data is copied at that point. However looking into EditView2 class (setup
and process
) methods I donāt see anything obvious there.
Anyone else have experience with this and know where I should be looking?
I canāt believe it is this hard to tell the convert lead page to use the email1
from the source Lead to populate the email1
on the Account we are going to create.