id
stringlengths
14
16
text
stringlengths
33
5.27k
source
stringlengths
105
270
40b215ff6a68-1
'exact_matches' => array(), 'regex_matches' => array( 0 => '6\\.5\\.(.*?)', 1 => '7\\.8\\.(.*?)\\.(.*?)', 2 => '7\\.9\\.(.*?)\\.(.*?)', 3 => '7\\.10\\.(.*?)\\.(.*?)' ), 'author' => 'SugarCRM', 'description' => 'Installs a sample set of custom fields to the accounts module', 'icon' => '', 'is_uninstallable' => true, 'name' => 'Example Custom Field Installer', 'published_date' => '2015-05-11 20:45:04', 'type' => 'module',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-2
'type' => 'module', 'version' => '1.0.0', ); $installdefs = array( 'id' => 'package_1341607504', 'language' => array( array( 'from' => '<basepath>/Files/Language/Accounts/en_us.lang.php', 'to_module' => 'Accounts', 'language' => 'en_us' ), ), 'custom_fields' => array( //Text array( 'name' => 'text_field_example_c', 'label' => 'LBL_TEXT_FIELD_EXAMPLE', 'type' => 'varchar', 'module' => 'Accounts',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-3
'module' => 'Accounts', 'help' => 'Text Field Help Text', 'comment' => 'Text Field Comment Text', 'default_value' => '', 'max_size' => 255, 'required' => false, // true or false 'reportable' => true, // true or false 'audited' => false, // true or false 'importable' => 'true', // 'true', 'false', 'required' 'duplicate_merge' => false, // true or false ), //DropDown array( 'name' => 'dropdown_field_example_c', 'label' => 'LBL_DROPDOWN_FIELD_EXAMPLE', 'type' => 'enum', 'module' => 'Accounts',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-4
'type' => 'enum', 'module' => 'Accounts', 'help' => 'Enum Field Help Text', 'comment' => 'Enum Field Comment Text', 'ext1' => 'account_type_dom', //maps to options - specify list name 'default_value' => 'Analyst', //key of entry in specified list 'mass_update' => false, // true or false 'required' => false, // true or false 'reportable' => true, // true or false 'audited' => false, // true or false 'importable' => 'true', // 'true', 'false' or 'required' 'duplicate_merge' => false, // true or false ), //MultiSelect array(
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-5
), //MultiSelect array( 'name' => 'multiselect_field_example_c', 'label' => 'LBL_MULTISELECT_FIELD_EXAMPLE', 'type' => 'multienum', 'module' => 'Accounts', 'help' => 'Multi-Enum Field Help Text', 'comment' => 'Multi-Enum Field Comment Text', 'ext1' => 'account_type_dom', //maps to options - specify list name 'default_value' => 'Analyst', //key of entry in specified list 'mass_update' => false, // true or false 'required' => false, // true or false 'reportable' => true, // true or false 'audited' => false, // true or false
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-6
'audited' => false, // true or false 'importable' => 'true', // 'true', 'false' or 'required' 'duplicate_merge' => false, // true or false ), //Checkbox array( 'name' => 'checkbox_field_example_c', 'label' => 'LBL_CHECKBOX_FIELD_EXAMPLE', 'type' => 'bool', 'module' => 'Accounts', 'default_value' => true, // true or false 'help' => 'Bool Field Help Text', 'comment' => 'Bool Field Comment', 'audited' => false, // true or false 'mass_update' => false, // true or false 'duplicate_merge' => false, // true or false
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-7
'duplicate_merge' => false, // true or false 'reportable' => true, // true or false 'importable' => 'true', // 'true', 'false' or 'required' ), //Date array( 'name' => 'date_field_example_c', 'label' => 'LBL_DATE_FIELD_EXAMPLE', 'type' => 'date', 'module' => 'Accounts', 'default_value' => '', 'help' => 'Date Field Help Text', 'comment' => 'Date Field Comment', 'mass_update' => false, // true or false 'required' => false, // true or false 'reportable' => true, // true or false 'audited' => false, // true or false
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-8
'audited' => false, // true or false 'duplicate_merge' => false, // true or false 'importable' => 'true', // 'true', 'false' or 'required' ), //DateTime array( 'name' => 'datetime_field_example_c', 'label' => 'LBL_DATETIME_FIELD_EXAMPLE', 'type' => 'datetime', 'module' => 'Accounts', 'default_value' => '', 'help' => 'DateTime Field Help Text', 'comment' => 'DateTime Field Comment', 'mass_update' => false, // true or false 'enable_range_search' => false, // true or false 'required' => false, // true or false
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-9
'required' => false, // true or false 'reportable' => true, // true or false 'audited' => false, // true or false 'duplicate_merge' => false, // true or false 'importable' => 'true', // 'true', 'false' or 'required' ), //Encrypt array( 'name' => 'encrypt_field_example_c', 'label' => 'LBL_ENCRYPT_FIELD_EXAMPLE', 'type' => 'encrypt', 'module' => 'Accounts', 'default_value' => '', 'help' => 'Encrypt Field Help Text', 'comment' => 'Encrypt Field Comment', 'reportable' => true, // true or false
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-10
'reportable' => true, // true or false 'audited' => false, // true or false 'duplicate_merge' => false, // true or false 'importable' => 'true', // 'true', 'false' or 'required' ), ), ); ?> Language Example <basepath>/Files/Language/Accounts/en_us.lang.php <?php $mod_strings['LBL_TEXT_FIELD_EXAMPLE'] = 'Text Field Example'; $mod_strings['LBL_DROPDOWN_FIELD_EXAMPLE'] = 'DropDown Field Example'; $mod_strings['LBL_CHECKBOX_FIELD_EXAMPLE'] = 'Checkbox Field Example';
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
40b215ff6a68-11
$mod_strings['LBL_MULTISELECT_FIELD_EXAMPLE'] = 'Multi-Select Field Example'; $mod_strings['LBL_DATE_FIELD_EXAMPLE'] = 'Date Field Example'; $mod_strings['LBL_DATETIME_FIELD_EXAMPLE'] = 'DateTime Field Example'; $mod_strings['LBL_ENCRYPT_FIELD_EXAMPLE'] = 'Encrypt Field Example'; Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Module_Loadable_Packages/Creating_an_Installable_Package_that_Creates_New_Fields/index.html
f5b5f47b19cf-0
Creating an Auto-Incrementing Field Overview This article will cover the two approaches to creating an auto-incrementing field in Sugar. Case 1: Auto-Incrementing a Field Using a Logic Hook The benefits of having an auto-incrementing field populated from a logic hook are that it can be incremented based on additional logic. It also allows for multiple auto-incrementing fields, while a database-level auto-incrementing field is only allowed once per table. Auto-incremented fields handled in a logic hook can also be formatted as needed, such as adding leading zeros or alpha characters. You can also control the auto-increment value based on another field, for instance, if you wanted to increase a version_number based on other records related to the same parent. For this example, we will create a simple auto-incrementing field that goes up by 1 whenever the record is saved for the first time.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-1
First, create an integer field incrementing_number_c in Studio. Next, create a custom class and method that the logic hook will call: ./custom/modules/Accounts/Accounts_Save.php <?php class Accounts_Save { function auto_increment($bean, $event, $arguments) { if (!$arguments['isUpdate']) { $sq = new \SugarQuery(); $sq->from(BeanFactory::newBean('Accounts'), ['team_security' => false]); $sq->select->fieldRaw('MAX(' . $sq->getFromAlias() . '_cstm.incrementing_number_c)', 'current_max_id'); $current_max_id = $sq->getOne();
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-2
$current_max_id = $sq->getOne(); $max_id = (empty($current_max_id)) ? 1 : $current_max_id + 1; $bean->incrementing_number_c = $max_id; } } } Next, register the custom logic hook via the LogicHooks Extension framework by creating a file at ./custom/Extension/modules/Accounts/Ext/LogicHooks. An example is shown below: ./custom/Extension/modules/Accounts/Ext/LogicHooks/autoIncrementOnSave.php <?php $hook_array['before_save'][] = array( 2, 'Custom Logic to Auto-Increment integer_field_c', 'custom/modules/Accounts/Accounts_Save.php',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-3
'custom/modules/Accounts/Accounts_Save.php', 'Accounts_Save', 'auto_increment' ); After creating these files, run a Quick Repair and Rebuild. Case 2: Creating an Auto-Incrementing Field on the Database Creating an auto-incrementing field at the database level has the benefit of being unique and easy to manage. One downside to having an auto-incrementing field at the database level is that it means only being allowed one such field per module, as databases only allow one auto-incrementing field per table. A custom auto-incrementing field also relies on updating a module's core table, which is less upgrade safe. For this reason, a logic hook based auto-incrementing field is recommended over a database-driven auto-incrementing field.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-4
To create an integer field in Sugar which auto-increments at the database level, we will create a custom field via the VarDefs extension as shown below: ./custom/Extension/modules/Accounts/Ext/Vardefs/autoIncrement.php <?php $dictionary['Account']['fields']['account_number_auto'] = array ( 'name' => 'account_number_auto', 'vname' => 'LBL_NUMBER_AUTO', 'type' => 'int', 'readonly' => true, 'len' => 11, 'required' => true, 'auto_increment' => true, 'unified_search' => true, 'full_text_search' => array( 'enabled' => true, 'searchable' => true,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-5
'enabled' => true, 'searchable' => true, 'boost' => 1.25 ), 'comment' => 'Visual unique identifier', 'duplicate_merge' => 'disabled', 'disable_num_format' => true, 'studio' => array('quickcreate' => false), 'duplicate_on_record_copy' => 'no', ); $dictionary['Account']['indices']['account_number_auto'] = array( 'name' =>'accountsnumk_cstm', 'type' =>'unique', 'fields'=>array('account_number_auto'), ); Navigate to Admin > Studio > Repair > Quick Repair and Rebuild. After the repair, you will see a vardef comparison as shown below:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-6
/*COLUMNS*/ /*MISSING IN DATABASE - account_number_auto - ROW*/ ALTER TABLE accounts add COLUMN account_number_auto int(11) NOT NULL auto_increment; /* INDEXES */ /*MISSING INDEX IN DATABASE - accountsnumk_cstm - unique ROW */ ALTER TABLE accounts ADD CONSTRAINT UNIQUE accountsnumk_cstm (account_number_auto);; Alter this to be the following and execute the changes: ALTER TABLE accounts add COLUMN account_number_auto int(11) UNIQUE NOT NULL auto_increment;
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
f5b5f47b19cf-7
Note: Since auto-incremented fields are populated at the database level, all existing records in the database will have this field populated as soon as the field is created on the database table. The value assigned will not be based on any logic (such as the record creation date) that can be controlled or predicted. Therefore when sorting by this field, records created after the field was added will be in order that they were created, but records created before will not. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Creating_an_Auto-Incrementing_Field/index.html
3eca6a819542-0
Disabling RLI Alerts on Opportunities Overview How to disable Revenue Line Item (RLI) alerts on Opportunities using a custom JavaScript controller. Overriding the Record View First, we must override the stock opportunities record view. This will handle the RLI alerts when navigating to an existing record. This can be done by creating: ./custom/modules/Opportunities/clients/base/views/record/record.js ({ extendsFrom: 'OpportunitiesRecordView', initialize: function (options) { this._super('initialize', [options]); }, /** * Hide the warning message about missing RLIs * @param string module The module that we are currently on. */ showRLIWarningMessage: function(module) { //here we create an empty override function }, /**
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Disabling_RLI_Alerts_on_Opportunities/index.html
3eca6a819542-1
//here we create an empty override function }, /** * @inheritdoc */ _dispose: function() { this._super('_dispose', []); } }) As you can see, this file extends from 'OpportunitiesRecordView' which points our code to extend the stock ./modules/Opportunities/clients/base/views/record/record.js file. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Disabling_RLI_Alerts_on_Opportunities/index.html
8f604914c4ab-0
Passing Data to Templates Overview This page explains how to create a custom view component that passes data to the Handlebars template. Steps to Complete The view component will render the actual content on the page. The view below will display data passed to it from the controller. ./custom/clients/base/views/my-dataview/my-dataview.js ({ className: 'tcenter', loadData: function (options) { //populate your data myData=new Object(); myData.myProperty = "My Value"; this.myData = myData; /* //alternatively, you can pass in a JSON array to populate your data myData = $.parseJSON( '{"myData":{"myProperty":"My Value"}}' ); _.extend(this, myData);
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Passing_Data_to_Templates/index.html
8f604914c4ab-1
_.extend(this, myData); */ this.render(); //reset flags on reload if (options && _.isFunction(options.complete)) { options.complete(); } // Another Alternative you can get the date from an end point let self = this; app.api.call("read", app.api.buildURL("Accounts/4bbd3b4e-755d-11e9-9a7b-f45c89a8598f"), null, { success: function (accountResponse) { self.myData['account'] = accountResponse; self.render(); }, }) }, }) Next, add the Handlebars template to render the data. An example is shown below:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Passing_Data_to_Templates/index.html
8f604914c4ab-2
Next, add the Handlebars template to render the data. An example is shown below: ./custom/clients/base/views/my-dataview/my-dataview.hbs {{#with myData}} {{account.name}} - {{account.assigned_user_name}} <br> {{myProperty}} {{/with}} Once the files are in place, add the view to a layout and then navigate to Admin > Repair > Quick Repair and Rebuild. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Passing_Data_to_Templates/index.html
9e1dfe418687-0
Converting Address' Country Field to a Dropdown Overview Address fields in Sugar® are normally text fields, which allow users to enter in the appropriate information (e.g. street, city, and country) for the record. However, with multiple users working in Sugar, it is possible for data (e.g. country) to be entered in a variety of different ways (e.g. USA, U.S.A, and United States) when creating or editing the record. This can cause some issues when creating a report grouped by the Billing Country field, for example, as records with the same country will be grouped separately based on the different ways the country was entered. Â
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-1
This article will cover how to change the address' Billing Country field to a dropdown list which will allow users to select a single value (e.g. USA) and maintain consistency in data throughout the system.     Note: This article pertains to Sugar versions 6.x and 7.x. Use Case In this example, we will convert the Billing Country field in the Accounts module to a dropdown-type field to allow values to be selected from a dropdown list. Prerequisites
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-2
Prerequisites A part of making this change involves mapping the "countries_dom" dropdown list to your existing Billing Country field's values. This dropdown list can be accessed and modified via Admin > Dropdown Editor. For more information on editing dropdown lists, please refer to the Developer Tools documentation. It is very important that the existing values in the Billing Country field exactly match the Item Name values in the "countries_dom" dropdown list in order for the values to convert properly. If the existing value (e.g. United States) does not match one of the country options (e.g. USA) in the dropdown list, then the new dropdown version of the Billing Country field will most likely default to a blank value for that record record.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-3
To avoid such issues, please review and update all of your existing Billing Country text field values prior to making this change. For more information on updating many records at once via import, please refer to the Updating Records Via Import article.  Steps to Complete Converting Field to Dropdown Use the following steps to change the Billing Country field to a dropdown list: First, we will associate the Billing Country field in the Accounts module with the "countries_dom" dropdown. Locate the following directory in your Sugar file system: ./custom/Extension/modules/Accounts/Ext/Vardefs/
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-4
Locate a file called sugarfield_billing_address_country.php which controls the billing_address_country field and add the following lines to the file. This will set the field type to 'enum' and define the dropdown (countries_dom) to use for the field. Note: If this file or location does not exist, then you will need to first create this path and file.Your file should look like this: <?php $dictionary['Account']['fields']['billing_address_country']['type']='enum'; $dictionary['Account']['fields']['billing_address_country']['options']='countries_dom';
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-5
Now, since the address block is handled uniquely in Sugar, we will also need to modify the template file in order to display the field as a dropdown anywhere the layout is being used in backward compatibility mode. To do this in an upgrade safe way, you will need to copy the file located in ./include/SugarFields/Fields/Address/en_us.EditView.tpl and place it in the following directory: ./custom/include/SugarFields/Fields/Address/. If you are using multiple languages in Sugar, you will need to make this change for each language-type in your system. For our example, we will be focusing on the "en_us" language.Note: You will most likely need to create this directory as it likely does not already exist.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-6
Once the en_us.EditView.tpl file is in the custom directory, locate the line for the input html element for the country field. The line of code should look similar to this:<input type="text" name="{{$country}}" id="{{$country}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$country}}.value}' tabindex="{{$tabindex}}"> Directly between the list shown above and the <td> appearing before it, add the following lines to display the field as a dropdown:{if (!isset($config.enable_autocomplete) || $config.enable_autocomplete==false) && isset($fields.{{$country}}.options)}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-7
<select name="{{$country}}" id="{{$country}}" title=''> {if isset($fields.{{$country}}.value) && $fields.{{$country}}.value != ''} {html_options options=$fields.{{$country}}.options selected=$fields.{{$country}}.value} {else} {html_options options=$fields.{{$country}}.options selected=$fields.{{$country}}.default} {/if} </select> {else}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-8
{/if} </select> {else} <input type="text" name="{{$country}}" id="{{$country}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$country}}.value}' tabindex="{{$tabindex}}"> {/if} Save the changes to the file. Once the necessary change has been made, please navigate to Admin > Repair and perform a Quick Repair and Rebuild in order for the change to take effect. Your Billing Country field will now display as a dropdown field in the Accounts module.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-9
Please note that only the Account module's Billing Country field will be converted to a dropdown field once this change is applied. If you wish to have the Shipping Country field converted to a dropdown as well, please follow the steps above, but be sure to make the change specific to the "shipping_address_country" field. In addition, you can make this change for other modules (e.g. Contacts and Leads) as well by specifying the appropriate module name (e.g. Contacts) and field name (e.g. Primary Address Country) when going through the steps. Updating the Field Type for List View Filter Once the appropriate changes have been made per the section above, use the following steps to get the list view filter to recognize the change: Navigate to Admin > Studio > Accounts > Layouts > Search.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-10
Navigate to Admin > Studio > Accounts > Layouts > Search. Drag the Billing Country field from the Default column to the Hidden column and click "Save & Deploy". Now drag the Billing Country field back to the Default column and click "Save & Deploy" again. This will retrieve the Billing Country field in its new state and add it to the account's list view filter. Application Once the Billing Country field is converted successfully to a dropdown, all records that had an existing value in the field should have the matching country automatically selected. Going forward, users will simply need to select the appropriate country when entering address information in Sugar.  Please note that administrators can add additional country values as necessary to the "countries_dom" dropdown via Admin > Dropdown Editor. For more information on editing dropdown lists, please refer to the Developer Tools documentation. Â
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
9e1dfe418687-11
The Billing Country field will now appear as follows: For Accounts record view:  For Accounts list view filter:   Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Changing_Address_Country_Field_to_a_Dropdown/index.html
cc22bc678d3b-0
Customizing the Email Editor Buttons Overview The Emails module in Sugar® displays commonly-used buttons in the HTML editor. This article explains how to modify the buttons on the editor's toolbar. Modifying The View The following sections outline how to customize the button toolbar presented within the TinyMCE editor. In the example below, we will be adding buttons for Cut, Copy, and Paste to the toolbar. Using Custom Module Metadata
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-1
Using Custom Module Metadata To override the Emails module compose-email view, we will need to copy ./modules/Emails/clients/base/views/compose-email/compose-email.php to ./custom/modules/Emails/clients/base/views/compose-email/compose-email.php. Once completed, we will then edit the ['tinyConfig']['toolbar'] definition to include | cut copy paste . An example of this is shown below: ./custom/modules/Emails/clients/base/views/compose-email/compose-email.php $viewdefs['Emails']['base']['view']['compose-email'] = array( ... 'panels' => array( array(
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-2
... 'panels' => array( array( ... 'fields' => array( ... array( 'name' => 'description_html', 'dismiss_label' => true, 'span' => 12, 'tinyConfig' => array( 'toolbar' => 'code | bold italic underline strikethrough | bullist numlist | ' . 'alignleft aligncenter alignright alignjustify | forecolor backcolor | ' . 'fontsizeselect | formatselect | fontselect | sugarattachment sugarsignature sugartemplate | cut copy paste', ), ), ), ), ... ), );
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-3
), ), ), ), ... ), ); Note: We recommend modifying the modules custom metadata for local deployments when the customization is not part of a distributed package. Once this file is in place, navigate to Admin > Repair > Quick Repair and Rebuild. Once completed, your changes will be reflected in the system. Using The Module Extension Framework To extend the Emails module compose-email view using the extension framework, we will need to loop through the existing views array definition to find and modify the description_html field and update the relevant sub-array ['tinyConfig']['toolbar'] with the additional toolbar buttons we want to display. An example of this is shown below:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-4
./custom/Extension/modules/Emails/Ext/clients/base/views/compose-email/add_toolbar_buttons.php <?php $target_view = 'compose-email'; $target_fieldname = 'description_html'; $default_toolbar = 'code | bold italic underline strikethrough | bullist numlist | ' . 'alignleft aligncenter alignright alignjustify | forecolor backcolor | ' . 'fontsizeselect | formatselect | fontselect | sugarattachment sugarsignature sugartemplate'; $custom_toolbar = ' | cut copy paste'; if (!empty($viewdefs['Emails']['base']['view'][$target_view]['panels'])) {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-5
$panels = $viewdefs['Emails']['base']['view'][$target_view]['panels']; foreach ($panels as $i => $panel) { if (!empty($panel['fields'])) { foreach ($panel['fields'] as $j => $field) { if ($field['name'] == $target_fieldname) { if(!isset($field['tinyConfig'])){ $field['tinyConfig'] = array(); } /* If toolbar already exists, add our custom buttons to the end, otherwise set it to the default and append that. */
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-6
otherwise set it to the default and append that. */ if(!isset($field['tinyConfig']['toolbar'])) { $field['tinyConfig']['toolbar'] = $default_toolbar; } $viewdefs['Emails']['base']['view'][$target_view]['panels'][$i]['fields'][$j]['tinyConfig']['toolbar'] = $field['tinyConfig']['toolbar'] . $custom_toolbar; } } } } } Note: We recommend using the extension framework when the code will be installed as part of a distributed package.Â
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
cc22bc678d3b-7
Once this file is in place, navigate to Admin > Repair > Quick Repair and Rebuild. Once completed, your changes will be reflected in the system. Toolbar Format As demonstrated in the examples above, the toolbar value is a string with the button keywords space-separated. The | indicates a divider should be shown in the editor. If the goal were to replace the toolbar buttons with only text-modifier buttons, the value for toolbar would be: 'bold italic | underline strikethrough' The toolbar button keywords are documented at TinyMCE Editor Control Identifiers. Note that at this time, only control keywords listed as "Core" are supported by Sugar®. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Email_Editor_Buttons/index.html
18add40a5d64-0
Removing the Account Requirement on Opportunities Overview This article covers how to remove the Account field from being required on the Opportunities module.  Removing the Requirement in Configuration By default, Sugar requires the accounts field to be populated on several modules. These modules include Opportunities Cases Contracts In order to remove this dependency, you will need to modify the require_accounts configuration in your  ./config_override.php. $sugar_config['require_accounts'] = false; The resulting file should look similar to: Removing the Requirement in Vardefs
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
18add40a5d64-1
The resulting file should look similar to: Removing the Requirement in Vardefs Once you have updated your configuration, you may find the field is still required. This may be due to the module's vardefs array having the field's required attribute set to true. This will also need to be updated. Using the Opportunities vardefs as an example, we will need to do the following: Create a custom file in the Opportunities Extension directory like ./custom/Extension/modules/Opportunities/Ext/Vardefs/no_account_required.php  Set the content of this file so that the account_name field has required set to false <?php $dictionary['Opportunity']['fields']['account_name']['required'] = false;
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
18add40a5d64-2
Once completed, you will need to navigate to Admin > Repairs and run a Quick Repair & Rebuild Removing the Requirement in View Metadata If the Account field is still required after making these changes, this may be due to the views metadata having the field's required attribute set to true. By default, account_name should not be set to required, but if you have created custom views, these may need to be updated. Using the Opportunities record view as an example, we will need to do the following: Edit  ./custom/modules/Opportunities/clients/base/views/record/record.php with a text editor application. Search for the account_name field in panel definitions of your record view.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
18add40a5d64-3
Search for the account_name field in panel definitions of your record view. Remove 'required' => true, from the account_name definition. If it doesn't already exist, you don't need to modify anything. ... 'fields' => array ( 0 => array ( 'name' => 'account_name', 'required' => false, ... Your resulting file should be: ... 'fields' => array ( 0 => array ( 'name' => 'account_name', ... These changes will only affect the record view for Opportunities. You may need to modify additional module layouts based on your use case. A list of other views you many need to modify for your module are shown below.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
18add40a5d64-4
./custom/modules/<module>/clients/base/views/list/list.php ./custom/modules/<module>/clients/base/views/record/record.php ./custom/modules/<module>/clients/base/views/dupecheck-list/dupecheck-list.php ./custom/modules/<module>/clients/base/views/resolve-conflicts-list/resolve-conflicts-list.php ./custom/modules/<module>/clients/base/views/selection-list/selection-list.php ./custom/modules/<module>/clients/base/views/subpanel-list/subpanel-list.php Once completed, you will need to navigate to Admin > Repairs and run a Quick Repair & Rebuild Application
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
18add40a5d64-5
Application Now that the appropriate changes have been made, navigate to the Opportunities module and create a new opportunity record. You will notice that the Account Name field no longer indicates "Required" in the field. In addition, the Account Name field will no longer be marked as required when importing records into the Opportunities module. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Removing_the_Account_Requirement_on_Opportunities/index.html
3f64acab13e3-0
Modifying Subpanel Buttons Overview Several buttons exist on each subpanel by default such as "Create" (+ Plus symbol) and "Link Existing Record". These buttons are controlled by the panel-top view for each module. To make changes to the buttons included in a subpanel layout, you will need to create an override for the panel-top view in ./custom/Extension/modules/<module>/Ext/clients/base/views/panel-top/ and update the corresponding buttons property to include or exclude a button. If you need to make changes to a specific relationships subpanel, then you will need to modify the subpanels layout definition for the relationship to point to a custom panel-top view that you define. Steps to Complete Editing Subpanel Buttons
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3f64acab13e3-1
Steps to Complete Editing Subpanel Buttons In this example, we will remove the "Create" button from the Contacts subpanel for all modules. This code snippet uses the same button definition that the create button uses. It has been changed to trigger the "Link Existing Record" action by setting the button type to link-action. The blank array after the initial button is just to assure that the drop-down button displays next to it as disabled for placement purposes. Create the file custom/Extension/modules/Contacts/Ext/clients/base/views/panel-top/panel-top.php as follows: <?php $viewdefs['Contacts']['base']['view']['panel-top']['buttons'] = array( array( 'type' => 'actiondropdown', 'name' => 'panel_dropdown',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3f64acab13e3-2
'name' => 'panel_dropdown', 'css_class' => 'pull-right', 'buttons' => array( array( 'type' => 'link-action', 'icon' => 'fa-link', 'name' => 'select_button', 'label' => ' ', 'tooltip' => 'LBL_ASSOC_RELATED_RECORD', ), array( ), ), ), ); Navigate to Admin > Repair and click "Quick Repair and Rebuild". The subpanel will appear as shown below for all Contacts subpanels. Using a Custom Panel-Top View for a Specific Relationship
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3f64acab13e3-3
Using a Custom Panel-Top View for a Specific Relationship In this example, we will only remove the "Create" action from a specific relationships subpanel. Specifically, the example will look at Contacts subpanel on the Accounts module and implement the above changes explicitly for that relationship. Create the custom panel-top view in ./custom/modules/Contacts/clients/base/views/panel-top-for-accounts/panel-top-for-accounts.php as follows: <?php $viewdefs['Contacts']['base']['view']['panel-top-for-accounts'] = array( 'type' => 'panel-top', 'template' => 'panel-top', 'buttons' => array( array( 'type' => 'actiondropdown', 'name' => 'panel_dropdown',
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3f64acab13e3-4
'name' => 'panel_dropdown', 'css_class' => 'pull-right', 'buttons' => array( array( 'type' => 'link-action', 'icon' => 'fa-link', 'name' => 'select_button', 'label' => ' ', 'tooltip' => 'LBL_ASSOC_RELATED_RECORD', ), array( ), ), ), ), ); Create the subpanel panel-top override definition for Accounts in ./custom/modules/Accounts/clients/base/layouts/subpanels/subpanels.php as follows:  <?php require 'modules/Accounts/clients/base/layouts/subpanels/subpanels.php';
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3f64acab13e3-5
foreach($viewdefs['Accounts']['base']['layout']['subpanels']['components'] as $key => $component){ if ($component['context']['link'] == 'contacts'){ $viewdefs['Accounts']['base']['layout']['subpanels']['components'][$key]['override_paneltop_view'] = 'panel-top-for-accounts'; break; } } Navigate to Admin > Repair and click "Quick Repair and Rebuild". Your changes will now be reflected in the system. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Subpanel_Action_Buttons/index.html
3bbf717b8a72-0
Increasing the Number of Dashboards Displayed in the Home Menu Overview By default, the "Home Dashboard" comes out-of-the-box with Sugar® to display on the home page. In addition, Sugar users with a Sugar Serve and/or Sugar Sell license type will have access to specialized Home page dashboards called "Service Console" and "Renewals Console".  Users have the ability to create new dashboards on their home page and build out its layout and dashlet set. Currently, Sugar imposes a limit of 50 dashboards that can be displayed under the Home module tab. So, when creating multiple dashboards, keep in mind that having more than 50 in the list of available dashboards will cause the ones in the beginning to be dropped off the list. This article covers how to increase the number of dashboards allowed in the Home menu via a code-level customization. Use Case
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3bbf717b8a72-1
Use Case In this example, we will make a code-level change to set the number of dashboards allowed in the Home menu to "80". Prerequisites This change requires code-level customizations. You will need direct access to the server as well as administrator access in Sugar in order 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 change. If not, please refer to the Partner Page to find a reselling partner to help with your development needs.  You will also need the following capabilities prior to making this code-level customization: You should have a working knowledge of PHP development and arrays. You should have access to a text editor that can be used for programming.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3bbf717b8a72-2
You should have access to a text editor that can be used for programming. If your Sugar instance is hosted on Sugar's cloud service or hosted on a server to which you do not have direct file access, you will need to know how to create and deploy Module Loader packages. For more information, please refer to the Module Loader section of the Developer Guide. Note: Sugar Sell Essentials customers do not have the ability to upload custom file packages to Sugar using Module Loader. Steps to Complete The following steps cover setting the number of dashboards allowed on the Home menu to "80" as an example:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3bbf717b8a72-3
Navigate to ./modules/Home/clients/base/views/module-menu/module-menu.php and copy the file contents to a new file at ./custom/modules/Home/clients/base/views/module-menu/module-menu.php. The contents of the file should look similar to this: <?php $viewdefs['Home']['base']['view']['module-menu'] = array( 'settings' => array( 'favorites' => 0, 'recently_viewed' => 10, 'recently_viewed_toggle' => 3, ), ); ?>
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3bbf717b8a72-4
), ); ?> Modify the ./custom/modules/Home/clients/base/views/module-menu/module-menu.php file and add the dashboards => 80, element to the array. The modified file should look similar to this:<?php $viewdefs['Home']['base']['view']['module-menu'] = array( 'settings' => array( 'dashboards' => 80, 'favorites' => 0, 'recently_viewed' => 10, 'recently_viewed_toggle' => 3, ), ); ?> Save the changes to the file and update the ownership and permissions of the files that were created. For more information on Linux-based stacks, please refer to the Required File System Permissions on Linux article.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3bbf717b8a72-5
For more information on Windows-based stacks, please refer to the Required File System Permissions on Windows With IIS article.  Finally, log into Sugar as an administrator, navigate to Admin > Repair, and perform a "Quick Repair and Rebuild". This will rebuild the cached files to fully implement the changes to your Sugar instance. Application Once the appropriate changes have been made, users should be able to create and view up to 80 dashboards on their home page and any previously missing dashboards should now display in the Home menu as well. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Increasing_the_Number_of_Dashboards_Displayed_in_the_Home_Menu/index.html
3a9f9f6c3a8a-0
This page applies to the legacy "BWC" calendar offering. Sugar has released a Sidecar-based calendar in version 11.2.0; this content does not apply to the Sidecar calendar. Modifying Calendar Item Colors Overview Each calendar event type (Meetings, Calls, and Tasks) has its own distinct color scheme. This article will review how to modify these colors, as well as demonstrate how to set the event color based on the event status. The color scheme for each calendar activity type is defined in the stock file ./modules/Calendar/CalendarDisplay.php in the $activity_colors array as shown below: public $activity_colors = array( 'Meetings' => array( 'border' => '#1C5FBD', 'body' => '#D2E5FC', ), 'Calls' => array(
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-1
), 'Calls' => array( 'border' => '#DE4040', 'body' => '#FCDCDC', ), 'Tasks' => array( 'border' => '#015900', 'body' => '#B1F5AE', ), ); This file can not be overridden or extended in an upgrade-safe way, but this array can still be overridden later in the rendering process allowing for an upgrade safe customization. Modifying the Calendar Activity Colors The CalendarDisplay class passes the $activity_colors array to javascript by way of the ./modules/Calendar/tpls/main.tpl Smarty template. In this template file, you will see the following code where the CAL.activity_colors object is setup:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-2
CAL.activity_colors = []; {foreach name=colors from=$activity_colors key=module item=v} CAL.activity_colors['{$module}'] = []; CAL.activity_colors['{$module}']['border'] = '{$v.border}'; CAL.activity_colors['{$module}']['body'] = '{$v.body}' {/foreach} This is where we can update the $activity_colors array in an upgrade safe manner. To do this, copy the template file from./modules/Calendar/tpls/main.tpl to ./custom/modules/Calendar/tpls/main.tpl. If we wanted to change Meetings to have a purple color scheme, we might choose:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-3
If we wanted to change Meetings to have a purple color scheme, we might choose: border: #580059body : #F2AEF5 To implement this, we'll update the activity colors array in the custom template file as follows: ./custom/modules/Calendar/tpls/main.tpl CAL.activity_colors = []; {foreach name=colors from=$activity_colors key=module item=v} CAL.activity_colors['{$module}'] = []; CAL.activity_colors['{$module}']['border'] = '{$v.border}'; CAL.activity_colors['{$module}']['body'] = '{$v.body}' {/foreach} {literal}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-4
{/foreach} {literal} CAL.activity_colors["Meetings"] = { "border": "#580059", "body": "#F2AEF5" }; {/literal} In the above code, the activity_colors entry for "Meetings" has specifically been altered to set the custom colors just for Meetings, leaving the other activity types as they were. Alternatively, the entire activity_colors array could be updated, replacing the original coming from CalendarDisplay. For example: ./custom/modules/Calendar/tpls/main.tpl CAL.activity_colors = []; {foreach name=colors from=$activity_colors key=module item=v} CAL.activity_colors['{$module}'] = [];
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-5
CAL.activity_colors['{$module}'] = []; CAL.activity_colors['{$module}']['border'] = '{$v.border}'; CAL.activity_colors['{$module}']['body'] = '{$v.body}' {/foreach} {literal} CAL.activity_colors = { "Meetings": { "border": "#580059", "body": "#F2AEF5" }, "Calls": { "border": "#DE4040", "body": "#FCDCDC" }, "Tasks": { "border": "#015900",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-6
"Tasks": { "border": "#015900", "body": "#B1F5AE" } }; {/literal} While Calls and Tasks have not been modified from their original colors, having the entire array defined here may make it easier to make further color customizations later on, since the modified activity_colors will be completely defined in the custom template file. After making the above changes, run a Quick Repair and Rebuild and reload the Calendar module in your browser to see the changes take effect. Customizing colors based on event status
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-7
Customizing colors based on event status If you wanted to go a step further, you might want to customize the colors based on the status of the activity. For example, perhaps for Meetings, the color should reflect if the Meeting status is Scheduled, Held, or Canceled. To achieve this, we will need to customize the javascript that actually renders the activities onto the calendar view, so we will copy ./modules/Calendar/Cal.js to ./custom/modules/Calendar/Cal.js. Additionally, in order for our custom template to load the custom Cal.js, it will need to be updated to point to the custom Cal.js by changing the line: {sugar_getscript file="modules/Calendar/Cal.js"} to {sugar_getscript file="custom/modules/Calendar/Cal.js"}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-8
{sugar_getscript file="custom/modules/Calendar/Cal.js"} The activity colors from the CAL.activity_colors object get applied in the Cal.js script at: el.style.backgroundColor = CAL.activity_colors[item.module_name]['body']; el.style.borderColor = CAL.activity_colors[item.module_name]['border']; The activity type (Meetings, Calls, Tasks) comes from item.module_name, as shown above. The activity's status can be found in the item.status variable. Using these, we can modify the color-setting logic to apply a status-specific color scheme to the Meeting items in the calendar, for example: if (item.module_name =="Meetings") {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-9
if (item.module_name =="Meetings") { el.style.backgroundColor = CAL.activity_colors[item.module_name][item.status]['body']; el.style.borderColor = CAL.activity_colors[item.module_name][item.status]['border']; } else { el.style.backgroundColor = CAL.activity_colors[item.module_name]['body']; el.style.borderColor = CAL.activity_colors[item.module_name]['border']; } This assumes that the 'Meetings' part of CAL.activity_colors has status-specific colors set. Therefore we will need to update our custom template file so that this is the case: ./custom/modules/Calendar/tpls/main.tpl {literal}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-10
{literal} CAL.activity_colors = { "Meetings": { "Planned": { "border": "#FF6666", "body": "#FF6666" }, "Held": { "border": "#FF9999", "body": "#FF9999" }, "Not Held": { "border": "#6C8CD5", "body": "#6C8CD5" } }, "Calls": { "border": "#DE4040", "body": "#FCDCDC" }, "Tasks": { "border": "#015900", "body": "#B1F5AE" }, "Planned": { "border": "#ff6666",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
3a9f9f6c3a8a-11
}, "Planned": { "border": "#ff6666", "body": "#ff6666" }, "Held": { "border": "#FF9999", "body": "#FF9999" }, "Not Held": { "border": "#6C8CD5", "body": "#6C8CD5" } }; {/literal} After making the above changes, run Rebuild JS Grouping Files followed by a Quick Repair and Rebuild, then reload the Calendar module in your browser to see the changes take effect. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Modifying_Calendar_Item_Colors/index.html
0a0183b5e8c0-0
Prepopulating the Compose Email View Overview When composing an email in Sugar, it may be useful to modify the compose view to better suit your common business practices. In this article, we will use JavaScript to create a code-level customization which causes the To, CC, and Subject fields of the email to prepopulate with data from a related Opportunity. Steps to Complete Create a Custom Compose Email View To modify the default compose email functionality, we will need to create our own compose-email view that extends from the base compose-email view. To accomplish this, we will need to create the following file: ./custom/modules/Emails/clients/base/views/compose-email/compose-email.js ({ extendsFrom: 'EmailsComposeEmailView', initialize: function(options){ this._super('initialize',[options]);
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Prepopulating_the_Compose_Email_View/index.html
0a0183b5e8c0-1
initialize: function(options){ this._super('initialize',[options]); this.configureDefaults(); }, /** * Configure the default data */ configureDefaults: function(){ var model = this.context.parent.get('model'); var module = this.context.parent.get('module'); if (module == 'Opportunities'){ var contacts; var oppName = model.get('name'); if (this.model.get('to_collection').length === 0) { var email = this.model; //Get the related contacts to the Opportunity contacts = model.getRelatedCollection('contacts'); contacts.fetch({ relate: true, success: function (data) { var ccRecords = [],
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Prepopulating_the_Compose_Email_View/index.html
0a0183b5e8c0-2
success: function (data) { var ccRecords = [], toRecords = []; data.forEach(function (record) { var parentName = app.utils.getRecordName(record); if (record.attributes.opportunity_role == 'Primary Decision Maker') { //Primary decisions makers are added to the TO Recipients toRecords.push(app.data.createBean('EmailParticipants', { _link: 'to', parent: _.extend({type: record.module}, record.attributes), parent_type: record.module, parent_id: record.get('id'), parent_name: parentName })); } else {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Prepopulating_the_Compose_Email_View/index.html
0a0183b5e8c0-3
parent_name: parentName })); } else { //All other contacts are added to the CC Recipients ccRecords.push(app.data.createBean('EmailParticipants', { _link: 'cc', parent: _.extend({type: record.module}, record.attributes), parent_type: record.module, parent_id: record.get('id'), parent_name: parentName })); } }); email.get('to_collection').add(toRecords); email.get('cc_collection').add(ccRecords); }, fields: ['id', 'full_name', 'email', 'opportunity_role'] }); }
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Prepopulating_the_Compose_Email_View/index.html
0a0183b5e8c0-4
}); } //Default the Subject of Email to the Opportunity Name email.set('name',oppName); } } }) Some key things to note about this customization: The custom view should extend from EmailsComposeEmailView When adding recipients to an Email Bean Model, you should create an EmailParticipants Bean Model and specify the _link property that will be used. This view will be used when clicking on the "Create" button in the Emails subpanel, or when clicking on Email Address on a record when the user is configured to use the Sugar Email Client Once you have added the custom code, execute a Quick Repair and rebuild via Admin > Repair > Quick Repair and Rebuild, and your changes should now be reflected in your instance. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Prepopulating_the_Compose_Email_View/index.html
1eefc417d286-0
Refreshing Subpanels on the RecordView Overview How to refresh specific subpanels on the Record View. Refreshing Subpanels When Working with the Record View, it is sometimes necessary to force the refresh of a subpanel. The following example will demonstrate how to add buttons to force refresh a specific subpanel or all subpanels on the Accounts RecordView. Adding the Button Metadata For our example, we will first create a metadata extension file to append our custom refresh buttons to the Accounts RecordView action menu. ./custom/Extension/modules/Accounts/Ext/clients/base/views/record/refreshButtons.php <?php //module name $module = 'Accounts'; //buttons to append $addButtons = array( array( 'type' => 'divider', ), array (
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-1
'type' => 'divider', ), array ( 'type' => 'rowaction', 'event' => 'button:refresh_specific_subpanel:click', 'name' => 'refresh_specific_subpanel', 'label' => 'LBL_REFRESH_SPECIFIC_SUBPANEL', 'acl_action' => 'view', ), array ( 'type' => 'rowaction', 'event' => 'button:refresh_all_subpanels:click', 'name' => 'refresh_all_subpanels', 'label' => 'LBL_REFRESH_ALL_SUBPANELS', 'acl_action' => 'view', ) );
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-2
'acl_action' => 'view', ) ); //if the buttons are missing in our base modules metadata, include core buttons if (!isset($viewdefs[$module]['base']['view']['record']['buttons'])) { require('clients/base/views/record/record.php'); $viewdefs[$module]['base']['view']['record']['buttons'] = $viewdefs['base']['view']['record']['buttons']; unset($viewdefs['base']); } foreach($viewdefs[$module]['base']['view']['record']['buttons'] as $outerKey => $outerButton) { if ( isset($outerButton['type'])
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-3
{ if ( isset($outerButton['type']) && $outerButton['type'] == 'actiondropdown' && isset($outerButton['name']) && $outerButton['name'] == 'main_dropdown' && isset($outerButton['buttons']) ) { /* //removing buttons by name foreach($viewdefs[$module]['base']['view']['record']['buttons'][$outerKey]['buttons'] as $innerKey => $innerButton) { if ( isset($innerButton['name']) && $innerButton['name'] == 'button_name' ) {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-4
) { unset($viewdefs[$module]['base']['view']['record']['buttons'][$outerKey]['buttons'][$innerKey]); } } */ //appending buttons foreach ($addButtons as $addButton) { $viewdefs[$module]['base']['view']['record']['buttons'][$outerKey]['buttons'][]=$addButton; } } } Next, we will create our language labels for the buttons. ./custom/Extension/modules/Accounts/Ext/Language/en_us.refreshButtons.php <?php
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-5
<?php $mod_strings['LBL_REFRESH_SPECIFIC_SUBPANEL'] = 'Refresh Specific Subpanel'; $mod_strings['LBL_REFRESH_ALL_SUBPANELS'] = 'Refresh All Subpanels'; Our next step is to extend the Accounts controller file. This is where we will add our code to refresh the subpanels when the buttons are clicked. ./custom/modules/Accounts/clients/base/views/record/record.js ({ extendsFrom: 'RecordView', initialize: function (options) { this._super('initialize', [options]); //add listeners for custom buttons this.context.on('button:refresh_specific_subpanel:click', this.refresh_specific_subpanel, this);
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-6
this.context.on('button:refresh_all_subpanels:click', this.refresh_all_subpanels, this); }, /** * Refreshes a specific subpanel given a link */ refresh_specific_subpanel: function() { var linkName = 'contacts'; var subpanelCollection = this.model.getRelatedCollection(linkName); subpanelCollection.fetch({relate: true}); }, /** * Refreshes all subpanels */ refresh_all_subpanels: function() { _.each(this.model._relatedCollections, function(collection){ collection.fetch({relate: true}); }); } })
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
1eefc417d286-7
collection.fetch({relate: true}); }); } }) Note: To refresh a specific subpanel, you will need to pass the linkname of the relationship to the this.model.getRelatedCollection() method. Finally, we will then need to navigate to Admin > Repair > Quick Repair and Rebuild. This will rebuild our extensions and make the refresh buttons available on our RecordView. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Refreshing_Subpanels_on_the_Record_View/index.html
b36cba6b260f-0
Disabling Tooltips Overview This article will demonstrate how to disable the tooltips in Sugar. Steps to Complete Creating a Custom JavaScript File First, we will need to create a custom JavaScript file. This file can technically exist anywhere within the root of your Sugar instance. custom/JavaScript/disable_tooltips.js (function(app){ app.events.on('app:init', function(){ // Clear existing ones app.tooltip.clear(); // Disable all app.tooltip._disable(); }); })(SUGAR.App); Appending to JSGroupings Second, we need to add our disable_tooltips.js file to sugar_grp7.min.js in our JSGroupings. custom/Extension/application/Ext/JSGroupings/disable_tooltips.php <?php
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Disabling_Tooltips/index.html
b36cba6b260f-1
<?php foreach ($js_groupings as $key => $groupings) { foreach ($groupings as $file => $target) { if ($target == 'include/javascript/sugar_grp7.min.js') { $js_groupings[$key]['custom/JavaScript/disable_tooltips.js'] = 'include/javascript/sugar_grp7.min.js'; } break; } } Note: More information about JSGroupings can be found here. Quick Repair and Rebuild
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Disabling_Tooltips/index.html
b36cba6b260f-2
Note: More information about JSGroupings can be found here. Quick Repair and Rebuild After creating the ./custom/JavaScript/disable_tooltips.js and ./custom/Extension/application/Ext/JSGroupings/disable_tooltips.php files, navigate to Admin > Repairs and perform a "Quick Repair and Rebuild". This will rebuild the cached files to fully implement the changes.  Once "Quick Repair and Rebuild" finishes, the tooltips will be disabled through Sugar. Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Disabling_Tooltips/index.html
7c603304dbd8-0
Enabling Importing for Custom Modules Overview When designing a custom module in Module Builder, you have the option to enable 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 made in Studio and potentially other areas of the application could be lost. This article will cover how to enable importing for custom modules via a code-level change to preserve any additional configurations made to the module since being deployed from Module Builder. Steps to Complete
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-1
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 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. Edit the ./modules/<module_key>_<module_name>/<module_key>_<module_name>_sugar.php file in your Sugar file system.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-2
Around line 24 of the file, locate and change public $importable = false; to public $importable = true;. Save your changes to the file. Next, edit the ./modules/<module_key>_<module_name>/clients/base/menus/header/header.php file which should look similar to this:$viewdefs[$moduleName]['base']['menu']['header'] = array( array( 'route' => "#$moduleName/create", 'label' => 'LNK_NEW_RECORD', 'acl_action' => 'create', 'acl_module' => $moduleName, 'icon' => 'fa-plus', ), array( 'route' => "#$moduleName",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-3
), array( 'route' => "#$moduleName", 'label' => 'LNK_LIST', 'acl_action' => 'list', 'acl_module' => $moduleName, 'icon' => 'fa-bars', ), ); Add the following line to the end of the file after the last  ), but before the ending );:array( 'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&return_module=$moduleName&return_action=index", 'label' => 'LBL_IMPORT', 'acl_action' => 'import', 'acl_module' => $moduleName, 'icon' => 'icon-upload', ),
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-4
'icon' => 'icon-upload', ), Save your changes to the file. The updated file should then look similar to this:$viewdefs[$moduleName]['base']['menu']['header'] = array( array( 'route' => "#$moduleName/create", 'label' => 'LNK_NEW_RECORD', 'acl_action' => 'create', 'acl_module' => $moduleName, 'icon' => 'fa-plus', ), array( 'route' => "#$moduleName", 'label' => 'LNK_LIST', 'acl_action' => 'list', 'acl_module' => $moduleName, 'icon' => 'fa-bars', ), array(
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-5
'icon' => 'fa-bars', ), array( 'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&return_module=$moduleName&return_action=index", 'label' => 'LBL_IMPORT', 'acl_action' => 'import', 'acl_module' => $moduleName, 'icon' => 'icon-upload', ), ); 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
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
7c603304dbd8-6
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, 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 documentation.   Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Enabling_Importing_for_Custom_Modules/index.html
6868b182307a-0
Moving Footer content to Sidebar Nav Overview This example explains how to add additional buttons to a new section in the sidebar nav layout. You may have previously customized a button that was added to the footer layout, which can be repurposed here and added to the sidebar-nav layout. We will create a custom view and append the view component to the sidebar-nav layout metadata. The additional button will merely show an alert and a flyout menu with a link to the Accounts module but can be expanded to do much more. Steps To Complete This tutorial requires the following steps, which are explained in the sections below: Extend the language files to include the new labels Creating the Custom View Appending the View to Layout Metadata Adding a Secondary Action Extending the Language files to Include New Labels We'll want to add a couple of new labels for our new sidebar-nav-item. To do this, create the following file:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
6868b182307a-1
./custom/Extension/application/Ext/Language/en_us.greetingNavItem.php <?php // Create the "Hello" label $app_strings['LBL_HELLO_C'] = 'Hello!'; Creating the Custom View with a Primary Action To add a new sidebar-nav-item, you will first need to create the custom view that extends sidebar-nav-item. To create the custom view create a folder in ./custom/clients/base/views with the name of your view, such as ./custom/clients/base/views/greeting-nav-item/. Once your folder is in place, you can create the two primary files that make up your view. By default, we can use the out-of-the-box template for our view. greeting-nav-item.js - Contains the JavaScript controller logic
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
6868b182307a-2
greeting-nav-item.js - Contains the JavaScript controller logic greeting-nav-item.php - Contains the metadata your view might use. For this example, we simply use the metadata to define whether the greeting will auto-close or not. ./custom/clients/base/views/greeting-nav-item/greeting-nav-item.js ({ extendsFrom: 'SidebarNavItemView', primaryActionOnClick: function() { app.alert.show('greeting-alert', { level: 'info', messages: 'Hello '+ app.user.get('full_name') + '!', autoClose: this.meta.autoClose || false }); }, })
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html