I'm tearing my hair out - please tell me there is a way to.....
1. Search for all Accounts in a specific Industry
2. Retrieve the Contact names from the resultant search and export them
How would I do this?
I'm tearing my hair out - please tell me there is a way to.....
1. Search for all Accounts in a specific Industry
2. Retrieve the Contact names from the resultant search and export them
How would I do this?
hi,
your first problem has solution if u do some simple customisation through studio option in admin....
and i dont get why u have trouble in importing searched contacts
as soon as u search the contact just tick the contacts and select import...
-John
I think he means exporting only the contacts relevant to the accounts search results.
I'd like to be able to do that, too...
And how can you customise what fields get exported into the spreadsheet? I know I could just delete the unwanted columns in the spread sheets, but it's a bit fiddley and I'd also like to add some custom fields to the resulting spreadhseet...
Thanks
Hi, craig4wdOriginally Posted by craig4wd
1. Search for all Accounts in a specific Industry: I believe you have already done it.
2. Retrieve the Contact names from the resultant search and export them.
You have to:
2.1. Create a controller for the Contacts module: Create the file custom/modules/Contacts/controller.php. The controller should have a function just like that:
This class (AnotherBean) is a class which extends the Contact class and override the function create_new_list_query, defined into data/SugarBean.phpPHP Code:function action_listview(){
$this->view_object_map['bean'] = $this->bean;
$this->view = 'list';
$GLOBALS['view'] = $this->view;
$this->bean = new AnotherBean();
}
You can override this function, calling the one defined into SugarBean and only make available the created query into $_SESSION. This new $_SESSION entry can be accessed by the action ExportContacts you will create.
2.2. Create a custom view.list.php: duplicate the include/MVC/VIew/views/view.list.php and paste to custom/modules/Contacts/views. Modify the constructor just like in modules/Activities/views/view.list.php
2.2.1. In the display function you have to instantiate the $lv from a custom ListVIew derived from include/ListView/ListViewSmarty.php. Just copy this file with another name and remove all functions, preserving just the constructor, which will be modified the enough.
2.2.2. Copy the function buildExportLink from include/ListView/ListViewDisplay and copy it to the new ListView Class.
Add another button, the Export Contacts, which will points to another action you will create.
2.3. Create a new action: At this action you can access the $_SESSION to retrieve the generated query, run it and gets the contacts name from DB. After saving all contacts into the variable $string, just add this lines at the end of the file:
Hope this help you.PHP Code:$badoutput = ob_get_contents();
if(strlen($badoutput) > 0) {
ob_end_clean();
}
header("Pragma: cache");
header("Content-type: application/octet-stream; charset=".$locale->getExportCharset());
header("Content-Disposition: attachment; filename=ad_delivery_import.csv");
header("Content-transfer-encoding: binary");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header("Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($string));
print $locale->translateCharset($string, 'UTF-8', $locale->getExportCharset());
sugar_cleanup(true);
echo $string;
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks