I just finished doing this... creating a campaign from my leads (Actually, adding Leads to a Target List then using the list in a campaign).
It'll take some customization work on two LEAD files,
a) popupdefs.php (in the /modules/leads/metadata directory)
b) Popup_picker.html (in the /modules/leads directory)
I. In the Popup_picker.html file, you'll need to open it in a text editor and do the following:
a. Find the code that starts the search form
Code:
<form action="index.php" method="post" name="popup_query_form" id="popup_query_form">
b. in the html code that follows, use common sense in copying a replacing the existing code and changing the copied code to reflect your custom data fields. I just took a whole row of existing code and copied it below the original so as not to disrupt the table. Here's a visual...
Find this:
Code:
<tr>
<td width="20%" class="dataLabel">{MOD.LBL_LEAD_SOURCE}</td>
<td width="30%" class="dataField"><select name="lead_source">{LEAD_SOURCE_OPTIONS}</select></td>
<td width="20%" class="dataLabel">{MOD.LBL_STATUS}</td>
<td width="30%" class="dataField"><select name="status">{STATUS_OPTIONS}</select></td>
<td class="dataLabel"> </td>
</tr> and change it into this (*NOTE: Change the INDUSTRY_C and LOCATION_C field names in the following example to whatever your custom field names are)
Code:
<tr>
<td width="20%" class="dataLabel">{MOD.LBL_LEAD_SOURCE}</td>
<td width="30%" class="dataField"><select name="lead_source">{LEAD_SOURCE_OPTIONS}</select></td>
<td width="20%" class="dataLabel">{MOD.LBL_STATUS}</td>
<td width="30%" class="dataField"><select name="status">{STATUS_OPTIONS}</select></td>
<td class="dataLabel"> </td>
</tr>
<tr>
<td width="20%" class="dataLabel">{MOD.INDUSTRY_C}</td>
<td width="30%" class="dataField"><input type="text" size="10" name="industry_c" class="dataField" value="{INDUSTRY_C}" /></td>
<td width="20%" class="dataLabel">{MOD.LOCATION_C}</td>
<td width="30%" class="dataField"><input type="text" size="10" name="location_c" class="dataField" value="{LOCATION_C}" /></td>
<td class="dataLabel"> </td>
</tr> c. Finally, find this code:
Code:
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{LEAD.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{LEAD.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{LEAD.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" valign='top'>{PREROW}</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" ><{TAG_TYPE} href="#" class="listViewTdLinkS1" onclick="send_back('Leads','{LEAD.ID}');">{LEAD.FULL_NAME}</{TAG_TYPE}></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{LEAD.ACCOUNT_NAME}</td>
</tr> and change it to this...
Code:
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{LEAD.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{LEAD.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{LEAD.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" valign='top'>{PREROW}</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" ><{TAG_TYPE} href="#" class="listViewTdLinkS1" onclick="send_back('Leads','{LEAD.ID}');">{LEAD.FULL_NAME}</{TAG_TYPE}></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{LEAD.ACCOUNT_NAME}</td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{LEAD.INDUSTRY_C}</td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{LEAD.LOCATION_C}</td>
</tr> d. save and upload to the appropriate directory.
II. Change the popupdefs.php file so that it includes your new fields
a. Where the original code is...
Code:
'whereClauses' =>
array('first_name' => 'leads.first_name',
'last_name' => 'leads.last_name',
'lead_source' => 'leads.lead_source',
'status' => 'leads.status'),
'selectDoms' => add your custom fields so that it resembles this...(remember to change the industry_c and location_c references to match your actual field names)
Code:
'whereClauses' =>
array('first_name' => 'leads.first_name',
'last_name' => 'leads.last_name',
'lead_source' => 'leads.lead_source',
'status' => 'leads.status',
'industry_c' => 'leads_cstm.industry_c',
'location_c' => 'leads_cstm.location_c'),
'selectDoms' => b. Still in the popupdefs.php file, add your custom field names to the 'Search Inputs' area. So, where it looks like this...
Code:
'searchInputs' =>
array('first_name', 'last_name', 'lead_source', 'status') add your custom field names so it resembles this...
Code:
'searchInputs' =>
array('first_name', 'last_name', 'lead_source', 'status', 'industry_c', 'location_c') c. Save the file and upload it to the appropriate directory on your server.
Next time you go to add Leads to a Target List which is to be used in a campaign, you will have two new Text Areas in which to enter either Industry or Location strings on which to search on. You can filter them in the popup to make adding them to a campaign easier.
*Note: You may want to temporarily increase your Maximum List items if you have a lot of leads to add. I up mine to anywhere between 200 and 500 when I need to add a lot of leads to a campaign. Don't forget to turn the limit back down (because this affects all users and all list panels).
Let me know if you have any questions/issues.
Good luck.
- MichaelEst
By the way, if you want to add a "Sort" capability to the lead list, open up the Popup_picker.html file and change the code as follows...
Find this code (this controls the List fields, which by default are only Lead Name and Account Name)...
Code:
<tr height="20">
<td scope="col" class="listViewThS1" NOWRAP>{CHECKALL}</td>
<td scope="col" width="50%" class="listViewThS1" nowrap="nowrap"> <a href="{ORDER_BY}last_name" class="listViewThLinkS1">{MOD.LBL_CONTACT_NAME}{arrow_start}{last_name_arrow}{arrow_end}</a></td>
<td scope="col" width="50%" class="listViewThS1" nowrap="nowrap"> {MOD.LBL_ACCOUNT_NAME}</td>
</tr> and change it to this...
Code:
<tr height="20">
<td scope="col" class="listViewThS1" NOWRAP>{CHECKALL}</td>
<td scope="col" width="25%" class="listViewThS1" nowrap="nowrap"> <a href="{ORDER_BY}last_name" class="listViewThLinkS1">{MOD.LBL_CONTACT_NAME}{arrow_start}{last_name_arrow}{arrow_end}</a></td>
<td scope="col" width="25%" class="listViewThS1" nowrap="nowrap"> {MOD.LBL_ACCOUNT_NAME}</td>
<td scope="col" width="25%" class="listViewThS1" nowrap="nowrap"> <a href="{ORDER_BY}industry_c" class="listViewThLinkS1">{MOD.industry_c}{arrow_start}{industry_c_arrow}{arrow_end}</a></td>
<td scope="col" width="25%" class="listViewThS1" nowrap="nowrap"> <a href="{ORDER_BY}location_c" class="listViewThLinkS1">{MOD.location_c}{arrow_start}{location_c_arrow}{arrow_end}</a></td>
</tr> Remember to change the industry_c and location_c fields to match your custom field names.
But beware, if you do have a large quantity of leads and you use the sort on the new/add'l fields, it has the impact of slowing Sugar down to a barely a crawl. It's best to sort them only AFTER you've already filtered them using the new search code outlined at the beginning of this post.
Bookmarks