Sei sulla pagina 1di 6

Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

Search

All Editions All Versions All Content Types SEARCH

GET STARTED (/GET_STARTED/INDEX.HTML) CASE


KNOWLEDGE BASE PORTAL (HTTPS://WEB.SUGARCRM.COM/SUPPORT/CASES)
(/KNOWLEDGE_BASE/INDEX.HTML)

DOCUMENTATION (/DOCUMENTATION/INDEX.HTML) RESOURCES (/RESOURCES/INDEX.HTML)

TRAINING (HTTPS://UNIVERSITY.SUGARCRM.COM/) COMMUNITY (HTTPS://COMMUNITY.SUGARCRM.COM/SUGARCRM)

Developer Customizations SugarCRM Support (/index.html) Knowledge Base (/Knowledge_Base


/index.html) Developer Customizations (/Knowledge_Base/Developers
/index.html) Customization (/Knowledge_Base/Developers/Customization
/index.html) Enabling Importing for Custom Modules
Customization
(/Knowledge_Base/Developers
/Customization/index.html)

Adding a Custom Compose


Enabling Importing for Custom
Modules
Email Button
(/Knowledge_Base
/Developers/Customization
/Adding_a_Custom_Compose_Email_Button
/index.html)
Overview
Changing the Default
Module When Logging a
New Call or Meeting When designing a custom module in Module Builder, you have the option to enable
(/Knowledge_Base
/Developers/Customization importing for the module. If the custom module is deployed without enabling this
option, it is not recommended that you redeploy the module since any changes
/Changing_the_Default_Module_When_Logging_a_N
/index.html) made in Studio and potentially other areas of the application could be lost. This
Creating a Custom Quote article will cover how to enable importing for custom modules via a code-level
Template (/Knowledge_Base
change to preserve any additional configurations made to the module since being
deployed from Module Builder.

Note: This article pertains to Sugar versions 6.x and 7.x.

Prerequisites

This change requires code-level customizations, and you will need direct access to
the server as well as administrator access in Sugar to perform the necessary
actions. If you need assistance making these changes and already have a
relationship with a Sugar partner, you can work with them to make this
customization. If not, please refer to the Partner Page (http://www.sugarcrm.com
/partners/channel-partners) to find a reselling partner to help with your
development needs.

Steps to Complete

To enable importing for your custom module, you must modify certain PHP files
depending on the version of Sugar that you have. Please note that the instructions
below apply to custom modules created via Admin > Module Builder and are not
applicable to any stock modules which come out-of-the-box with Sugar. All of the
directory paths are relative to the root directory of Sugar on the web server and

1 de 6 05/04/2017 21:20
Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

require you to replace the <module_key> and <module_name> variables with


appropriate values for your situation. For instance, if your module is installed in the
directory of ./modules/abc_custom_module/ then the <module_key> would be
abc and <module_name> would be custom_module .

Sugar 7
1. Edit the
./modules/<module_key>_<module_name>/<module_key>_<module_name>_sugar.php
file in your Sugar file system.
2. Around line 24 of the file, locate and
change public $importable = false; to public $importable = true; .
3. Save your changes to the file.
4. Next, edit the
./modules/<module_key>_<module_name>/clients/base/menus/header/header.php
file which should look similar to this:

1 $viewdefs[$moduleName]['base']['menu']['header'] = array(
2 array(
3 'route' => "#$moduleName/create",
4 'label' => 'LNK_NEW_RECORD',
5 'acl_action' => 'create',
6 'acl_module' => $moduleName,
7 'icon' => 'fa-plus',
8 ),
9 array(
10 'route' => "#$moduleName",
11 'label' => 'LNK_LIST',
12 'acl_action' => 'list',
13 'acl_module' => $moduleName,
14 'icon' => 'fa-bars',
15 ),
16 );

5. Add the following line to the end of the file after the last ), but before the
ending ); :

1 array(
2 'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&retu
3 'label' => 'LBL_IMPORT',
4 'acl_action' => 'import',
5 'acl_module' => $moduleName,
6 'icon' => 'icon-upload',
7 ),

6. Save your changes to the file. The updated file should then look similar to
this:

2 de 6 05/04/2017 21:20
Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

1 $viewdefs[$moduleName]['base']['menu']['header'] = array(
2 array(
3 'route' => "#$moduleName/create",
4 'label' => 'LNK_NEW_RECORD',
5 'acl_action' => 'create',
6 'acl_module' => $moduleName,
7 'icon' => 'fa-plus',
8 ),
9 array(
10 'route' => "#$moduleName",
11 'label' => 'LNK_LIST',
12 'acl_action' => 'list',
13 'acl_module' => $moduleName,
14 'icon' => 'fa-bars',
15 ),
16 array(
17 'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&r
18 'label' => 'LBL_IMPORT',
19 'acl_action' => 'import',
20 'acl_module' => $moduleName,
21 'icon' => 'icon-upload',
22 ),
23 );

Once the necessary changes have been made, log into Sugar and navigate to
Admin > Repair and perform a "Quick Repair and Rebuild". This will rebuild the
cached files to fully implement the changes.

Sugar 6
1. Edit the
./modules/<module_key>_<module_name>/<module_key>_<module_name>_sugar.php
file in your Sugar file system.
2. Around line 41 of the file, locate and change var $importable = false;
to var $importable = true; .
3. Save your changes to the file.
4. Next, locate the ./modules/<module_key>_<module_name>/Menu.php file.
If this file exists, add the following code to the end of the file and save
your changes:

1 if(ACLController::checkAccess('<module_key>_<module_name>', 'import'
2 $module_menu[]=Array(
3 "index.php?module=Import&action=Step1&import_module=<module_key
4 $app_strings['LBL_IMPORT'],
5 "Import",
6 '<module_key>_<module_name>'
7 );

If this file does not exist, create the file with proper permissions for your
Linux (/Knowledge_Base/Platform_Management
/Required_File_System_Permissions_on_Linux/index.html) or Windows
(/Knowledge_Base/Platform_Management
/Required_File_System_Permissions_on_Windows_With_IIS
/index.html) server. The contents of the file should be as follows:

3 de 6 05/04/2017 21:20
Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'
3
4 global $mod_strings, $app_strings, $sugar_config;
5
6 if(ACLController::checkAccess('<module_key>_<module_name>', 'edit'
7 $module_menu[]=Array(
8 "index.php?module=<module_key>_<module_name>&action=EditView&return_module
9 $mod_strings['LNK_NEW_RECORD'],
10 "Create<module_key>_<module_name>",
11 '<module_key>_<module_name>'
12 );
13 if(ACLController::checkAccess('<module_key>_<module_name>', 'list'
14 $module_menu[]=Array(
15 "index.php?module=<module_key>_<module_name>&action=index&return_module
16 $mod_strings['LNK_LIST'],
17 "<module_key>_<module_name>",
18 '<module_key>_<module_name>'
19 );
20 if(ACLController::checkAccess('<module_key>_<module_name>', 'import'
21 $module_menu[]=Array(
22 "index.php?module=Import&action=Step1&import_module=<module_key
23 $app_strings['LBL_IMPORT'],
24 "Import",
25 '<module_key>_<module_name>'
26 );

5. Finally, edit the


./modules/<module_key>_<module_name>/language/en_us.lang.php file (or
the file pertaining to the language preferred by the customer).
6. Add the following line of code to the $mod_strings array:

'LBL_IMPORT' => 'Import <display_module_name>',

7. Save your changes to the language file.

Once the necessary changes have been made, log into Sugar and navigate to
Admin > Repair and perform a "Quick Repair and Rebuild". This will rebuild the
cached files to fully implement the changes.

Application

After making these changes, the "Import {Module Name}" option will appear in the
Actions menu of the custom module's module tab. Simply click the triangle in the
module tab (for Sugar 7) or hover on the module tab (for Sugar 6) then select the
Import option to create or update records for your custom module. For instructions
on using Sugar's Import tool, please refer to the Import (/SmartLinks
/Application_Guide/Import/index.html) documentation.

From Sugar 7:

From Sugar 6:

4 de 6 05/04/2017 21:20
Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

Last modified: 2017-03-06 02:07pm

< Previous (/Knowledge_Base Handling Validation Task Errors | Next


/Developers/Customization > (/Knowledge_Base/Developers
/Dynamically_Hiding_Subpanels_Based_on_Record_Values /Customization
/index.html) | Dynamically Hiding /Handling_Validation_Task_Errors
Subpanels Based on Re... /index.html)

How helpful is this page?


Provide Feedback

CRM PRODUCTS & RESOURCES SUPPORT &

SOLUTIONS CRM Resources COMMUNITY

Products (http://www.sugarcrm.com Support

(http://www.sugarcrm.com /crm-resources) (http://support.sugarcrm.com/)

/products/products- Case Studies Training & Certification

overview) (http://www.sugarcrm.com (http://university.sugarcrm.com)

Editions & Pricing /case-studies) Partner Directory

(http://www.sugarcrm.com Whitepapers (http://www.sugarcrm.com

/products/editions- (http://www.sugarcrm.com /partners)

and-pricing) /whitepapers) Developers

CRM Solutions Webcasts (http://developer.sugarcrm.com)

(http://www.sugarcrm.com (http://www.sugarcrm.com Community Forums

/solutions) /webcasts) (https://community.sugarcrm.com)

SugarCRM Mobile Demos Partner Portal Login

(http://www.sugarcrm.com (http://www.sugarcrm.com (http://www.sugarcrm.com

/mobile) /demos) /partners/partner_portal)

Store

(http://store.sugarcrm.com) NEWS ABOUT

5 de 6 05/04/2017 21:20
Enabling Importing for Custom Modules - SugarCRM Support Site http://support.sugarcrm.com/Knowledge_Base/Developers/Customizatio...

SugarExchange Press Releases Company Overview

(http://www.sugarexchange.com/)
(http://www.sugarcrm.com (http://www.sugarcrm.com

/news/press-releases) /about/company-

News overview)

(http://www.sugarcrm.com Careers

/news/headlines) (http://www.sugarcrm.com

Events /about/careers)

(http://www.sugarcrm.com Privacy Policy

/news/events) (http://www.sugarcrm.com

Awards /sugarcrm-inc-privacy-

(http://www.sugarcrm.com policy)

/news/awards) Security Policy

CRM Blog (http://www.sugarcrm.com

(http://blog.sugarcrm.com/) /sugarcrm-security-

Partner News policy)

(http://www.sugarcrm.com Terms & Conditions

/news/partner-news) (http://www.sugarcrm.com

/sugarcrm-terms-of-use)

Environmental Policy

(http://www.sugarcrm.com

/environmental-policy)

Impressum

(http://www.sugarcrm.com

/de/impressum)

SUGAR

WORLDWIDE:

Select Region

STAY CONNECTED:

6 de 6 05/04/2017 21:20

Potrebbero piacerti anche