SugarCRM 7 - Enable Importing on Custom Modules
Thu 11 September 2014

I've been wracking my brain trying to get this guide to work with SugarCRM 7. Add to the fact that it "looks" like this is also how it's done in SugarCRM 7, if you peruse the code under Accounts or Contacts. However it isn't. This is how I've added importing support to custom modules.
Set Module as Importable
Under modules/<ModuleName>/<ModuleName>_sugar.php set
public $importable = true;
Add Menu Item
Under modules/<ModuleName>/clients/base/menus/header/header.php you should have something like
$moduleName = '<ModuleName>';
$viewdefs[$moduleName]['base']['menu']['header'] = array(
array(
'route' => "#$moduleName/create",
'label' => 'LNK_NEW_RECORD',
'acl_action' => 'create',
'acl_module' => $moduleName,
'icon' => 'icon-plus',
),
array(
'route' => "#$moduleName",
'label' => 'LNK_LIST',
'acl_action' => 'list',
'acl_module' => $moduleName,
'icon' => 'icon-reorder',
),
);
If not create the file with that array. Next add the import action to the array.
array(
'route' => '#bwc/index.php?' . http_build_query(
array(
'module' => 'Import',
'action' => 'Step1',
'import_module' => $moduleName,
)
),
'label' =>'LBL_IMPORT',
'acl_action'=>'import',
'acl_module'=>$moduleName,
'icon' => 'icon-upload',
),
Add language setting
Under /modules/<ModuleName>/language/en_us.lang.php add into the $mod_strings array(if it's not already there):
'LBL_IMPORT' => 'Import <ModuleName>',
Finally
The inevitable quick repair/rebuild.
Category: SugarCRM