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

Dear Friends,

Could you please give instructions or code to add the subpanel of Target List to modules of Leads or Contacts or Targets?

I found an old article at:
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Subpanels/Examples/How_to_Add_a_Target_List_Subpanel_for_Leads_and_Contacts/

But this set of instructions are not applicable to SuiteCRM 7.7 series of installation.

There was another write-up also at:;
http://enable.services/blog/sugarcrm-how-to/how-add-campaigntarget-list-support-custom-person-module-sugarcrm

This article seems to give instruction to do so w.r.t., any custom module.

Your guidance/help is solicited in achieving this in SuiteCRM 7.7.x.

With thanks,

RK

I need to add Subpanel to Accounts for simpli add account to an existing LIST. How can i do this please?

Thanks!

I would need this help as well. How do I add a “add to target list” subpanel to Leads and Contacts?

Hi,

To add the target list subpanel to contacts, add the following file:


custom/Extension/modules/Contacts/Ext/Layoutdefs/contact_targetlists_subpanel.php

with content:


<?php
$layout_defs['Contacts']['subpanel_setup']['targetlists'] = array(
        'order' => 1,
        'sort_order' => 'desc',
        'title_key' => 'LBL_TARGETLISTS',
        'subpanel_name' => 'default',
        'module' => 'ProspectLists',
        'get_subpanel_data' => 'prospect_lists',
        'top_buttons' => array(
                array('widget_class' => 'SubPanelTopSelectButton'),
        )
);

Add the following file


custom/Extension/modules/Contacts/Ext/Language/en_us.contact_targetlists_subpanel.php

With content:


<?php
$mod_strings['LBL_TARGETLISTS'] = 'Target lists';

Afterwards do a admin - Repair - “Quick Repair and Rebuild”

Or alternatively install the module attached.

For other modules this should work as well.

3 Likes

Hi @jansiero, thank you for putting together the installable ZIP, it works like a charm :slight_smile:

One more thing: I am still missing the option to filter contacts belonging to a certain target list. This was possible in the last Sugar-Installation we were using but apparently didn’t make it into SuiteCRM.

Could you give me a hint how to re-introduce the target list selector into the contact filter again? The field is not available in the filter layout list in the studio.

Thank you and have a nice day
Matthias

Hi Matthias,

you can add the target list to the contact filter by adding two files:

Add the file:

custom/Extension/modules/Contacts/Ext/Vardefs/targetlistfilter.php

with content:


<?php
$dictionary['Contact']['fields']['prospect_list_name'] = array (
	'name' => 'prospect_list_name',
	'rname' => 'name',
	'id_name' => 'prospect_list_id',
	'vname' => 'LBL_PROSPECTLIST_NAME',
	'type' => 'relate',
	'link' => 'prospect_lists',
	'table' => 'prospect_lists',
	'isnull' => 'true',
	'module' => 'ProspectLists',
	'dbType' => 'char',
	'len' => '255',
	'source' => 'non-db',
	'duplicate_merge'=> 'disabled',
);

Add the file:

custom/Extension/modules/Contacts/Ext/Language/en_us.targetlistfilter.php

with content:


<?php
$mod_strings['LBL_PROSPECTLIST_NAME'] = 'Target List:';

Afterwards, do a Admin / Repair / Quick Repair and Rebuild

Open Studio, module Contacts / Layouts / Filter
The filter field Target List is now available in the Hidden list and can be added to the Quick Filter and the Advance Filter layout.

1 Like

Hi Jan,

thank you for your solution for (re)-introducing the target list filter to the contacts, it works great.

Meanwhile, I have one more question regarding the original thread request of adding the target list subpanel to the contact module:

When i click the “select” button in the target list subpanel for addding the contact to another list, the selection popup opens, but the existing lists are not displayed and thus cannot be selected. Could you provide us with a way to get this working again?

Best
Matthias

Hi Matthias,

this should display the already created lists. Could you:

  • In the target list select dialog, click the “Clear” button to clear out any existing search field contents,
  • After this, click the “Search” button?

If this doens’t help, could you try admin / Repair / “Quick repair and rebuild” and then try again?

Hi Jan,

thank your for your quick reply. Actually, there are no clear and search buttons in the popup, it seems to be the dialogue for creating a new target list, see the screenshot attached.

I performed a quick repair twice, no change.

Regards
Matthias

Hi Matthias,

could you check if you get the same dialog if you place the following after your suitecrm url (make sure you’re logged in before opening the URL)?

/?module=ProspectLists&action=Popup

For example, if your URL is

https://crm.mycompany.de

then open url

https://crm.mycompany.de/?module=ProspectLists&action=Popup

Could you let us know which version of SuiteCRM you are using?

Good morning!

Yes, if I open the URL you posted (/?module=ProspectLists&action=Popup), I get the same dialogue (target list creation dialogue with the buttons “Save” and “Cancel”. The page is opening in the tab where I put the URL, no popup is opened.

We are using version 7.10.4.

Best
Matthias

One more thing I just noticed: If I hit the “create target list” button in the actions sidebar in the target list module, a popup with an error message opens (see attached image). Right now, it does not seem to be possible to create a new target list, the only way is to duplicate an existing list, emptying it manually and rename it.

Hi Matthias,

It seems that your views were corrupted by upgrades from previous versions.

Could you check if the following directories exists?

custom/modules/ProspectLists
custom/Extension/modules/ProspectLists

If they exist, then backup these directories, delete them, perform a admin / repair / “Quick Repair and Rebuild” and check again.

1 Like

Hi Jan,

thank you again for helping out, deleting the folders as suggested did the trick :slight_smile: !

Have a nice day
Matthias

@jansiero
It would be great if you added this code in gitHub to the core SuiteCRM system so that everybody could benefit from it.
From my understanding it’s just a matter to do the same for all the modules that are connected to target lists (accounts, contacts, leads, targets and users).

Hello @jansiero
I am looking for the ZIP file that was mentioned in this conversation - do you still have it? I can’t see where to get it from the old chat.
Thanks very much,
Vanessa

Hi,

Here it is. The previous file must have been lost when the forum was migrated to another forum software.

contact_targetlist.zip (15.8 KB)

1 Like

Thank you kindly @jansiero

When i add this filter to Targets module and search, it is working good. But when i try to exports all list, there is a database error. What is wrong?

“Database failure. Please refer to suitecrm.log for details.”

In log:

Sun Dec 6 22:35:20 2020 [20131][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Mysqli_query failed.
Sun Dec 6 22:35:20 2020 [20131][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 ‘1. gönderim gerçek liste%’)) 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 ‘1. gönderim gerçek liste%’)) AND prospects.deleted=0 : MySQL error 1054: Unknown column ‘prospect_list_name’ in ‘where clause’
Sun Dec 6 22:35:20 2020 [20131][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Exception handling in /var/www/sucrm/crm/include/MVC/Controller/SugarController.php:400
Sun Dec 6 22:35:20 2020 [20131][e433d2f0-c23e-3ad2-bd4d-5ee727929421][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Sun Dec 6 22:35:20 2020 [20131][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/custom/biz_FLA/classes/FLA_custom_export_utils.php(191): MysqliManager->query(‘SELECT\n\t\t\t\t\tpro
’, true, ‘Error exporting
’)
#4 /var/www/sucrm/crm/field_access_control_export.php(74): 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,

I just checked this on Suite 7.11.18.

I added the filter to the targets module, added the field to the filter, filtered on the target list name, selected the search results and exported. This worked flawlessly.

Could the error be caused by your custom code? You have a custom class in your stack trace:

#3 /var/www/sucrm/crm/custom/biz_FLA/classes/FLA_custom_export_utils.php(191): MysqliManager->query('SELECT\n\t\t\t\t\tpro...', true, 'Error exporting...')