Reputation: 141
I have created custom module in Sugar CRM. The data / lead to this module is coming from web-forms. When I export leads of this module to the excel sheet then I get all data in excel sheet. But I don't want all data to be exported.
Any idea how to customize it ? I am using community version of Sugar CRM.
Thanks in advance.
Upvotes: 4
Views: 2043
Reputation: 906
Add a overriding method create_export_query in your modules bean class (i.e. Leads.php or YourModule.php).
For example if you override the standard export function like this your export contains only the field "special_field_c".
function create_export_query(&$order_by, &$where){
$custom_join = $this->custom_fields->getJOIN(true, true);
$query = "SELECT
contacts_cstm.special_field_c as special ";
if ($custom_join) {
$query .= $custom_join['select'];
}
$query .= " FROM contacts
LEFT JOIN contacts_cstm
ON contacts.id=contacts_cstm.id_c ";
if ($custom_join) {
$query .= $custom_join['join'];
}
$where_auto = " contacts.deleted=0 ";
$query .= empty($where) ? "WHERE $where_auto" : "WHERE ($where) AND $where_auto";
$query .= empty($order_by) ? "" : " ORDER BY " . $this->process_order_by($order_by, null);
return $query;
}
Upvotes: 1
Reputation: 413
There is a predefined entry for export. You need to override the export entryPoint and you can customize your export functionality.
export entryPoint directly hit on export.php at root directory
Create entry_point_registry.php file, add following code in it
$entry_point_registry['export'] = array('file' => 'your_file_path/export.php', 'auth' => true);
Upvotes: 1