How to add a Target Lists Subpanel to Leads or Contacts etc?

Hi @jansiero,

I uninstalled related plugin and tried again. It was same. What is problem, i don’t know?

I m trying new instance of 7.11.15. Same thing happen. If you select first page records and then export, it is working. But if you select all records in bulk action menu, it doesn’t work.
If i select all records page by page, i can export them. The problem is “select all” function :frowning:

Mon Dec 7 17:52:06 2020 [30995][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Mysqli_query failed.
Mon Dec 7 17:52:06 2020 [30995][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Error exporting Prospects:
.SELECT
prospects.,
email_addresses.email_address email_address,
‘’ email_addresses_non_primary, users.user_name as assigned_user_name ,prospects_cstm.jjwg_maps_geocode_status_c,prospects_cstm.jjwg_maps_lng_c,prospects_cstm.jjwg_maps_lat_c,prospects_cstm.target_tag_c,prospects_cstm.jjwg_maps_address_c FROM prospects LEFT JOIN users
ON prospects.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on prospects.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module = ‘Prospects’ and email_addr_bean_rel.deleted = 0 and email_addr_bean_rel.primary_address = 1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id LEFT JOIN prospects_cstm ON prospects.id = prospects_cstm.id_c WHERE ((prospect_list_name like ‘15 ŞUBAT 2018 KONFERANS KATILIMCI LİSTESİ%’)) AND prospects.deleted=0 Query Failed: SELECT
prospects.
,
email_addresses.email_address email_address,
‘’ email_addresses_non_primary, users.user_name as assigned_user_name ,prospects_cstm.jjwg_maps_geocode_status_c,prospects_cstm.jjwg_maps_lng_c,prospects_cstm.jjwg_maps_lat_c,prospects_cstm.target_tag_c,prospects_cstm.jjwg_maps_address_c FROM prospects LEFT JOIN users
ON prospects.assigned_user_id=users.id LEFT JOIN email_addr_bean_rel on prospects.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module = ‘Prospects’ and email_addr_bean_rel.deleted = 0 and email_addr_bean_rel.primary_address = 1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id LEFT JOIN prospects_cstm ON prospects.id = prospects_cstm.id_c WHERE ((prospect_list_name like ‘15 ŞUBAT 2018 KONFERANS KATILIMCI LİSTESİ%’)) AND prospects.deleted=0 : MySQL error 1054: Unknown column ‘prospect_list_name’ in ‘where clause’
Mon Dec 7 17:52:06 2020 [30995][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Exception handling in /var/www/sucrm/crm/include/MVC/Controller/SugarController.php:400
Mon Dec 7 17:52:06 2020 [30995][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Mon Dec 7 17:52:06 2020 [30995][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] backtrace:
#0 /var/www/sucrm/crm/include/database/DBManager.php(353): sugar_die(‘Database failur…’)
#1 /var/www/sucrm/crm/include/database/DBManager.php(328): DBManager->registerError(‘Error exporting…’, ‘Error exporting…’, true)
#2 /var/www/sucrm/crm/include/database/MysqliManager.php(179): DBManager->checkError(‘Error exporting…’, true)
#3 /var/www/sucrm/crm/include/export_utils.php(194): MysqliManager->query(‘SELECT\n\t\t\t\t\tpro…’, true, ‘Error exporting…’)
#4 /var/www/sucrm/crm/export.php(69): export(‘Prospects’)
#5 /var/www/sucrm/crm/include/MVC/Controller/SugarController.php(1020): require_once(’/var/www/sucrm/…’)
#6 /var/www/sucrm/crm/include/MVC/Controller/SugarController.php(468): SugarController->handleEntryPoint()
#7 /var/www/sucrm/crm/include/MVC/Controller/SugarController.php(373): SugarController->process()
#8 /var/www/sucrm/crm/include/MVC/SugarApplication.php(113): SugarController->execute()
#9 /var/www/sucrm/crm/index.php(52): SugarApplication->execute()
#10 {main}

Hi @dtosun,

Coincidentally I stumbled upon the edit of your latest post. Your directive to use “select all” was key to reproduce the bug you found. You should really emphasize when you discover details on how to reproduce by posting a new comment.

The problem is caused by legacy code for exporting in the file
include/SugarObjects/templates/person/Person.php

To fix it, comment out the following function and its contents (line 296 to line 345)

public function create_export_query($order_by, $where, $relate_link_join = '')

This legacy code made sure to export the e-mail addresses. It is obsolete as this is already supported by the base class method Sugarbean::create_export_query

1 Like

Yes you are right.
Thank you for your support. When i comment out the function, it is working good.
when i comment out it, are there any bad effect to other export funcstions?

Hi, if you look into the function you will see its only purpose is to add email addresses. I don’t expect adverse effects apart from a changed order of columns in the exported file.

1 Like

Hi @dtosun,

On second thought, commenting out the create_export_query method does have adverse side effects:

  • The export doesn’t contain non-primary email addresses
  • Adding items to target lists from the list view may be affected
  • Creating PDF letters from the list view may be affected
  • JJWG Google Maps integration may be affected

I’m looking into it, but haven’t yet finalized a fix.

1 Like