Hi,
I have found this about this issue : Contact Email Address not showing in Subpanels · Issue #168 · salesagility/SuiteCRM-Core · GitHub
This is a major issue in V8 as users cant click on emails in the list and have to open every contact to check if there is an email !
Any information to solve this ?
Thanks for your answers
Xavier
There’s a workaround here . Enable sorting on the email, then click on column to sort it, and the emails appear.
Thanks Chris,
How Can I “enable sorting” on email ?
Thanks
Xavier
Here is a step by step on how to enable the sorting , in your case, on the email in the subpanel.
Hi Chris
I check the page you gave me : this is an explanation to show or hide fields in subpanels, but I dont see how to order the field itself.
To be sure, I have change the order of the field in the table (to put email on the first colum) but it does not change anything…
What did I miss ?
Thanks
Xavier
@azzy9 Could you explain your workaround for this issue, how exactly did you “enable the sort by option for the emails and then sort by the email in the sub-panel ” in version 8.x ?
Hi Chris,
Uh… I dont want to “sort”, I want to see the emails ! You told me to activate the “sort option” but I dont see any option to enable this sorting in the studio.
The only goal is to be able to see the email in the subpanel Contacts in the module Accounts.
Thanks for your help
Xavier
azzy9
15 November 2023 09:58
8
Hi, I didn’t mean for it as a work around, but to point out that it was a relationship issue in the query, as by sorting it forces it to include the email table into the query.
But for the answer:
go to the sub-panel metadata you want e.g. /legacy/custom/modules/Contacts/metadata/subpanels/Account_subpanel_contacts.php
and then add 'sortable' => true,
like:
'email1' =>
array (
'name' => 'email1',
'vname' => 'LBL_LIST_EMAIL',
'widget_class' => 'SubPanelEmailLink',
'width' => '30%',
'sortable' => true,
'default' => true,
),
1 Like
azzy9
15 November 2023 10:25
9
I just had a quick look, and came up with a very quick dirty way to sort it. use at your own risk.
got to line #932 in /public/legacy/data/SugarBean.php
after
// Find related email address for sub panel ordering
if ($order_by && isset($subpanel_def->panel_definition['list_fields'][$order_by]['widget_class']) &&
$subpanel_def->panel_definition['list_fields'][$order_by]['widget_class'] === 'SubPanelEmailLink' &&
!array_key_exists($order_by, $subquery['query_fields'])) {
$relatedBeanTable = $subpanel_def->table_name;
$relatedBeanModule = $subpanel_def->get_module_name();
$subquery['select'] .= ",
(SELECT email_addresses.email_address
FROM email_addr_bean_rel
JOIN email_addresses ON email_addresses.id = email_addr_bean_rel.email_address_id
WHERE
email_addr_bean_rel.primary_address = 1 AND
email_addr_bean_rel.deleted = 0 AND
email_addr_bean_rel.bean_id = $relatedBeanTable.id AND
email_addr_bean_rel.bean_module = '$relatedBeanModule') as $order_by";
}
add:
// changed to fix https://github.com/salesagility/SuiteCRM-Core/issues/168#issuecomment-1309063873
elseif (isset($subpanel_def->panel_definition['list_fields']['email1']['widget_class']) &&
$subpanel_def->panel_definition['list_fields']['email1']['widget_class'] === 'SubPanelEmailLink' &&
!array_key_exists('email1', $subquery['query_fields'])) {
$relatedBeanTable = $subpanel_def->table_name;
$relatedBeanModule = $subpanel_def->get_module_name();
$subquery['select'] .= ",
(SELECT email_addresses.email_address
FROM email_addr_bean_rel
JOIN email_addresses ON email_addresses.id = email_addr_bean_rel.email_address_id
WHERE
email_addr_bean_rel.primary_address = 1 AND
email_addr_bean_rel.deleted = 0 AND
email_addr_bean_rel.bean_id = $relatedBeanTable.id AND
email_addr_bean_rel.bean_module = '$relatedBeanModule') as email1";
}
I haven’t seen anything wrong yet and with the conditions shouldn’t cause any problems, but again use at your own risk
1 Like
Thanks
As the CRM is active, I will not make change “on my own risk” on it
I will try on a dev one to be sure of the result first.
Thanks for your help
Xavier
1 Like
Any good result trying on the dev CRM v8?
Is it consistently showing emails in Email column in subpanel Contacts for Accounts module?
I made a Pull Request to fix this bug, thanks @azzy9
salesagility:hotfix
← chris001:patch-2
opened 06:11PM - 30 Dec 23 UTC
The Emails column of the Contacts subpanel in the Accounts module is empty! It … should contain the primary email address of each related Contact. Serious issue for users!
## Description
Quick and dirty fix to this issue. Thanks to forum user azzy9.
Note, There may be a more standard way to fix this, for example, check for missing relationship Contact to primary Email address, and add it.
## Motivation and Context
Users cannot see email address, in the Contacts subpnel, of Contacts related to an Account.
## How To Test This
Before this fix, go to an Account, open the Contacts subpanel, you'll see the Email column is empty for all Contacts related to this Account.
After this fix, you'll see the expected Email addresses in the Email column of the Contacts subpanel of an Account.
## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
### Final checklist
- [x] My code follows the code style of this project found [here](https://docs.suitecrm.com/community/contributing-code/coding-standards/).
- [ ] My change requires a change to the documentation.
- [x] I have read the [**How to Contribute**](https://docs.suitecrm.com/community/contributing-code/) guidelines.
1 Like
Thanks to all of you for this
And… happy new yar 2024 to everyone !!!
Xavier
4 Likes