customize SugarCRM out-of-box module field(s)
When deploying a SugarCRM project, there is always required to customize out-of-box modules.
Here is the tutorial to teach your guys how to customize a field from Accounts module.
1. Create a new file call “custom_Account_OOB_Fields.php”
View Code PHP
<?php //SET BILLING POSTALCODE AS A MANDATORY FIELD $GLOBALS["dictionary"]["Account"]['fields']['billing_address_postalcode']['required'] = true; //SET THE HELP TEXT TO A CUSTOM TEXT $GLOBALS["dictionary"]["Account"]['fields']['billing_address_postalcode']['comment'] = 'This is billing address postal code'; //SET BILLING COUNTRY DEFAULT VALUE TO MYS $GLOBALS["dictionary"]["Account"]['fields']['billing_address_country']['default_value'] = 'MYS'; ?> |
2. Build a installation manifest file
View Code PHP
<?php /********************************************************************************* * The contents of this file are subject to the SugarCRM Professional Subscription * Agreement ("License") which can be viewed at * http://www.sugarcrm.com/crm/products/sugar-professional-eula.html * By installing or using this file, You have unconditionally agreed to the * terms and conditions of the License, and You may not use this file except in * compliance with the License. Under the terms of the license, You shall not, * among other things: 1) sublicense, resell, rent, lease, redistribute, assign * or otherwise transfer Your rights to the Software, and 2) use the Software * for timesharing or service bureau purposes such as hosting the Software for * commercial gain and/or for the benefit of a third party. Use of the Software * may be subject to applicable fees and any use of the Software without first * paying applicable fees is strictly prohibited. You do not have the right to * remove SugarCRM copyrights from the source code or user interface. * * All copies of the Covered Code must include on each user interface screen: * (i) the "Powered by SugarCRM" logo and * (ii) the SugarCRM copyright notice * in the same form as they appear in the distribution. See full license for * requirements. * * Your Warranty, Limitations of liability and Indemnity are expressly stated * in the License. Please refer to the License for the specific language * governing these rights and limitations under the License. Portions created * by SugarCRM are Copyright (C) 2004-2009 SugarCRM, Inc.; All Rights Reserved. ********************************************************************************/ $manifest = array ( 'acceptable_sugar_versions' => array ( ), 'acceptable_sugar_flavors' => array( 'PRO' ), 'readme'=>'', 'key'=>'myhow2guru', 'author' => 'myhow2guru', 'description' => 'Customize account OOB fields.', 'icon' => '', 'is_uninstallable' => true, 'name' => 'custom_accounts', 'published_date' => '2010-03-23 04:49:46', 'type' => 'module', 'version' => '1.0.0', 'remove_tables' => 'prompt', ); $installdefs = array ( 'id' => 'custom_accounts', 'beans' => ), 'layoutdefs' => array ( ), 'relationships' => array ( ), 'image_dir' => '', 'copy' => array ( ), 'language' => array ( ), 'vardefs' => array ( 0 => array ( 'from' => '<basepath>/SugarModules/vardefs/custom_Accounts_OOB_Fields.php', //Location of the file above inside the zip 'to_module' => 'Accounts', //Set to the module name that you need to customize ), ), 'layoutfields' => array ( ), ); |
3. Zip the whole package in correct folders structure.
4. Install the package into development instance.
5. Go into Admin > Repair > Quick Repair and repair Accounts module.
6. Check out the Accounts module for the customization.
7. Deploy to production instance if everything working fine.
Here is a sample of the installation package.
It’s great article. I was looking for same solution since long time. Thanks for posting.