id
stringlengths 14
16
| text
stringlengths 33
5.27k
| source
stringlengths 105
270
|
---|---|---|
6868b182307a-3
|
});
},
})
./custom/clients/base/views/greeting-nav-item/greeting-nav-item.php:
<?php
$viewdefs['base']['view']['greeting-nav-item'] = array(
'autoClose' => true
);
Appending the View to Layout Metadata
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-4
|
'autoClose' => true
);
Appending the View to Layout Metadata
Once the view is created, you simply need to add the view to the sidebar-nav Layout metadata. The sidebar-nav Layout is located in ./clients/base/layouts/sidebar-nav/, so appending the view to this layout can be done via the Extension Framework. Create a file  ./custom/Extension/application/Ext/clients/base/layouts/sidebar-nav/ and the Extension Framework will append the metadata to the sidebar-nav Layout.
./custom/Extension/application/Ext/clients/base/layouts/sidebar-nav/greeting-nav-item.php
<?php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-5
|
<?php
$viewdefs['base']['layout']['sidebar-nav']['components'][] = [
'view' => [
'name' => 'greeting-nav-item',
'type' => 'greeting-nav-item',
'icon' => 'sicon-bell-lg',
'label' => 'LBL_HELLO_C',
'template' => 'sidebar-nav-item',
],
];
Once all the files are in place, you can run a Quick Repair and Rebuild and a new group  sidebar-nav-item at the bottom of the sidebar-nav bar layout.
Â
Note:Â You may need to refresh the page to see the profile menu items removed.
Adding a Secondary Action
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-6
|
Adding a Secondary Action
With the introduction of the sidebar-nav-item component, we're now introducing Secondary Actions. These appear by way of a kebab menu when hovering on the sidebar-nav-item container to which they are added. It can be configured similarly to a Primary Action.
In this example, we'll add a secondary action to our greeting-nav-item view. It will trigger a flyout menu that has a link to the Accounts module.
First, let's add a new label to the language file we created earlier for our flyout menu header:
<?php
// Create the "Greetings" header
$app_strings['LBL_GREETINGS_C'] = 'Greetings';
Â
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-7
|
Â
Next, we can define the components that will be used in the flyout menus via metadata in greeting-nav-item.php. The new metadata looks like this:
./custom/Extension/application/Ext/clients/base/layouts/sidebar-nav/greeting-nav-item.php
<?php
$viewdefs['base']['layout']['sidebar-nav']['components'][] = [
'view' => [
'name' => 'greeting-nav-item',
'type' => 'greeting-nav-item',
'icon' => 'sicon-bell-lg',
'label' => 'LBL_HELLO_C',
'secondary_action' => true,
'template' => 'sidebar-nav-item',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-8
|
'template' => 'sidebar-nav-item',
'flyoutComponents' => [
[
'view' => 'sidebar-nav-flyout-header',
'title' => 'LBL_GREETINGS_C',
],
[
'view' => [
'type' => 'sidebar-nav-flyout-actions',
'actions' => [
[
'route' => '#Accounts',
'label' => 'LBL_ACCOUNTS',
'icon' => 'sicon-account-lg',
],
],
],
],
],
],
];
Â
Once these changes are added, you can run a Quick Repair and Rebuild and sidebar-nav-item will be updated with a Secondary Action.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-9
|
Â
Note:Â You may need to refresh the page to see the profile menu items removed.
Â
Customizing the sidebar-nav-item Template
By default, our new sidebar-nav-item is using the base Handlebars template. If you'd like to customize the template, create the following Handlebar Template file greeting-nav-item.hbs. The following snippet is the template for the base view for reference.Â
./custom/clients/base/views/greeting-nav-item/greeting-nav-item.hbs
{{#if appIsSynced}}
<button class="sidebar-nav-item-btn w-full bg-transparent absolute p-0 text-base text-initial"
rel="tooltip"
data-placement="{{tooltipPlacement}}"
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-10
|
data-placement="{{tooltipPlacement}}"
title="{{str label}}"
>
<span class="collapsed block ml-0 px-5.5 py-2" rel="tooltip" data-placement="{{tooltipPlacement}}" title="{{str label module}}">
<i class="{{buildIcon icon}} text-white"></i>
</span>
<span class="expanded ellipsis_inline ml-0 px-5.5 py-2 text-white" rel="tooltip" data-placement="{{tooltipPlacement}}" title="{{str label module}}">
<i class="{{buildIcon icon}} text-white"></i>
<span class="text-sm pl-4.5">{{str label}}</span>
</span>
</button>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-11
|
</span>
</button>
{{#if secondaryAction}}
<button class="sidebar-nav-item-kebab bg-transparent absolute p-0 h-full">
<i class="{{buildIcon 'sicon-kebab'}} text-white"></i>
</button>
{{/if}}
{{/if}}
Next, in ./custom/Extension/application/Ext/clients/base/layouts/sidebar-nav/greeting-nav-item.php remove the 'template' => 'sidebar-nav-item' metadata entry.Â
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-12
|
Note: Sidebar components must be expanded/collapsed state aware now, therefore you must make sure to provide collapsed (simple icon) and expanded (icon + text) class elements in your buttons.
Changing position of sidebar-nav-item
If you need to change the position of the sidebar-nav-item in the sidebar-nav layout, it is recommended that the layout be redefined using custom metadata. For example, if you wanted to move the group we created above, we could define the custom metadata as such:
./custom/clients/base/layouts/sidebar-nav/sidebar-nav.php
<?php
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-13
|
* terms available at
* http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
*/
$viewdefs['base']['layout']['sidebar-nav'] = [
'components' => [
[
'layout' => '...',
],
[
'layout' => [
'type' => 'sidebar-nav-item-group-modules',
'css_class' => 'flex-grow flex-shrink',
],
],
[
'layout' => [
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-14
|
],
],
[
'layout' => [
'type' => 'sidebar-nav-item-group',
'name' => 'sidebar-nav-item-group-bottom',
'css_class' => 'flex-grow-0 flex-shrink-0',
'components' => [
[
'view' => [
'name' => 'footer-greet-button',
'type' => 'footer-greet-button',
'route' => '#Accounts',
'icon' => 'sicon-bell-lg',
'label' => 'Hello!',
'flyoutComponents' => [
[
'view' => 'sidebar-nav-flyout-header',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-15
|
'view' => 'sidebar-nav-flyout-header',
'title' => 'Greetings',
],
[
'view' => [
'type' => 'sidebar-nav-flyout-actions',
'actions' => [
[
'route' => '#Accounts',
'label' => 'LBL_ACCOUNTS',
'icon' => 'sicon-account-lg',
],
],
],
],
],
],
],
],
],
],
[
'layout' => [
'type' => 'sidebar-nav-item-group',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
6868b182307a-16
|
'type' => 'sidebar-nav-item-group',
'name' => 'sidebar-nav-item-group-bottom',
'css_class' => 'flex-grow-0 flex-shrink-0',
'components' => [ ... ],
],
],
],
];
Note:Â Although this is a best practice for customizing base metadata, these base layouts are subject to change and may be changed in the future. Maintenance of these customizations belongs to the owner of the instance.
Â
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Moving_Footer_content_to_Sidebar_Nav/index.html
|
cb0ad2db4387-0
|
Customizing the Start Speed of List View Search
Overview
When searching a Sidecar module's list view, Sugar® begins returning results automatically once a predefined number of milliseconds have passed. This article covers how to customize the start speed of the list view search for Sidecar modules in Sugar.
Prerequisites
This change requires code-level customizations, and you will need direct access to the server in order to make the necessary changes in the file system. If you 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 to find a reselling partner to help with your development needs.Â
Note: If your instance is hosted in Sugar's cloud environment, you can create a package that can be installed within Admin > Module Loader. For more information, please refer to the Creating an Installable Package That Copies Files article.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Start_Speed_of_List_View_Search/index.html
|
cb0ad2db4387-1
|
Note: Sugar Sell Essentials customers do not have the ability to upload custom file packages to Sugar using Module Loader.
Use Case
By default, the list view search process in Sugar begins to run 400 milliseconds after a user stops typing or pasting values into one of the search fields. For some users or situations, the system-defined start speed for list view search may be considered too fast. We will walk through increasing the length of time it takes before the search starts to run, using 750 milliseconds as an example.
Steps to Complete
The function that controls the list view search speed in Sugar can be found in the following file: ./clients/base/views/filter-quicksearch/filter-quicksearch.js In order to customize this function, please use the following steps to create an extension in the ./custom/ directory:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Start_Speed_of_List_View_Search/index.html
|
cb0ad2db4387-2
|
Navigate to the ./custom/ directory in the Sugar file system and create the following directory structure if it does not already exist: ./clients/base/views/filter-quicksearch/.
In a text editor application, create a new file.
Copy the code provided below into this new file:({
extendsFrom: 'FilterQuicksearchView',
/**
* @override
* @param {Object} opts
*/
initialize: function(opts) {
this._super('initialize', [opts]);
},
/**
* Fire quick search
* @param {Event} e
*/
throttledSearch: _.debounce(function(e) {
var newSearch = this.$el.val();
if(this.currentSearch !== newSearch) {
this.currentSearch = newSearch;
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Start_Speed_of_List_View_Search/index.html
|
cb0ad2db4387-3
|
this.currentSearch = newSearch;
this.layout.trigger('filter:apply', newSearch);
}
}, 750),
})
For our example, the value of "750" at the end of the code represents the new start speed of list view search. Feel free to replace it with your desired value in milliseconds.
Save the new file as./custom/clients/base/views/filter-quicksearch/filter-quicksearch.js.
Update the Ownership and Permissions of the directories and file that were created.
For more information on Linux based stacks, please refer to the article Required File System Permissions on Linux.
For more information on Windows-based stacks, please refer to the article Required File System Permissions on Windows With IIS.
Finally, log into Sugar and navigate to Admin > Repair then perform a "Quick Repair and Rebuild".
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Start_Speed_of_List_View_Search/index.html
|
cb0ad2db4387-4
|
After completing the steps in this article, Sugar will wait 750 milliseconds before returning search results once the user has stopped entering search criteria.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Customizing_the_Start_Speed_of_List_View_Search/index.html
|
0a667cf3ea8e-0
|
Adding the Email Field to a Bean
Overview
This example explains how to add an emails field for modules that don't extend the Person module template. We will create an email field and bring the email functionality module bean. The steps are applicable for stock and custom modules. In this example, we will add the email field into the Opportunities module.
Steps to Complete
This tutorial requires the following steps, which are explained in the sections below:
Creating a Custom Vardef file for email Field and Relationships
Creating a Custom Bean and Modify the save function
Replacing the stock bean with the custom bean
Adding Emails Field into Record View
Creating a Custom Vardef file for email Field and Relationships
You will create a file in the custom/Extension/modules/Opportunities/Â folder for the field and relationships definitions.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-1
|
./custom/Extension/modules/Opportunities/Ext/Vardefs/custom_email_field.php
<?php
$module = 'Opportunity';
$table_name = 'opportunities';
$dictionary[$module]['fields']['email'] = array(
'name' => 'email',
'type' => 'email',
'query_type' => 'default',
'source' => 'non-db',
'operator' => 'subquery',
'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
'db_field' => array(
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-2
|
'db_field' => array(
'id',
),
'vname' => 'LBL_EMAIL_ADDRESS',
'studio' => array(
'visible' => true,
'searchview' => true,
'editview' => true,
'editField' => true,
),
'duplicate_on_record_copy' => 'always',
'len' => 100,
'link' => 'email_addresses_primary',
'rname' => 'email_address',
'module' => 'EmailAddresses',
'full_text_search' => array(
'enabled' => true,
'searchable' => true,
'boost' => 1.50,
),
'audited' => true,
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-3
|
),
'audited' => true,
'pii' => true,
);
$dictionary[$module]['fields']['email1'] = array(
'name' => 'email1',
'vname' => 'LBL_EMAIL_ADDRESS',
'type' => 'varchar',
'function' => array(
'name' => 'getEmailAddressWidget',
'returns' => 'html',
),
'source' => 'non-db',
'link' => 'email_addresses_primary',
'rname' => 'email_address',
'group' => 'email1',
'merge_filter' => 'enabled',
'module' => 'EmailAddresses',
'studio' => false,
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-4
|
'module' => 'EmailAddresses',
'studio' => false,
'duplicate_on_record_copy' => 'always',
'importable' => false,
);
$dictionary[$module]['fields']['email2'] = array(
'name' => 'email2',
'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
'type' => 'varchar',
'function' => array(
'name' => 'getEmailAddressWidget',
'returns' => 'html',
),
'source' => 'non-db',
'group' => 'email2',
'merge_filter' => 'enabled',
'studio' => 'false',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-5
|
'studio' => 'false',
'duplicate_on_record_copy' => 'always',
'importable' => false,
'workflow' => false,
);
$dictionary[$module]['fields']['invalid_email'] = array(
'name' => 'invalid_email',
'vname' => 'LBL_INVALID_EMAIL',
'source' => 'non-db',
'type' => 'bool',
'link' => 'email_addresses_primary',
'rname' => 'invalid_email',
'massupdate' => false,
'studio' => 'false',
'duplicate_on_record_copy' => 'always',
);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-6
|
'duplicate_on_record_copy' => 'always',
);
$dictionary[$module]['fields']['email_opt_out'] = array(
'name' => 'email_opt_out',
'vname' => 'LBL_EMAIL_OPT_OUT',
'source' => 'non-db',
'type' => 'bool',
'link' => 'email_addresses_primary',
'rname' => 'opt_out',
'massupdate' => false,
'studio' => 'false',
'duplicate_on_record_copy' => 'always',
);
$dictionary[$module]['fields']['email_addresses_primary'] = array(
'name' => 'email_addresses_primary',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-7
|
'name' => 'email_addresses_primary',
'type' => 'link',
'relationship' => strtolower($table_name) . '_email_addresses_primary',
'source' => 'non-db',
'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
'duplicate_merge' => 'disabled',
'primary_only' => true,
);
$dictionary[$module]['fields']['email_addresses'] = array(
'name' => 'email_addresses',
'type' => 'link',
'relationship' => strtolower($table_name) . '_email_addresses',
'source' => 'non-db',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-8
|
'source' => 'non-db',
'vname' => 'LBL_EMAIL_ADDRESSES',
'reportable' => false,
'unified_search' => true,
'rel_fields' => array('primary_address' => array('type' => 'bool')),
);
// Used for non-primary mail import
$dictionary[$module]['fields']['email_addresses_non_primary'] = array(
'name' => 'email_addresses_non_primary',
'type' => 'varchar',
'source' => 'non-db',
'vname' => 'LBL_EMAIL_NON_PRIMARY',
'studio' => false,
'reportable' => false,
'massupdate' => false,
);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-9
|
'reportable' => false,
'massupdate' => false,
);
$dictionary[$module]['relationships'][strtolower($table_name) . '_email_addresses'] = array(
'lhs_module' => $table_name,
'lhs_table' => strtolower($table_name),
'lhs_key' => 'id',
'rhs_module' => 'EmailAddresses',
'rhs_table' => 'email_addresses',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'email_addr_bean_rel',
'join_key_lhs' => 'bean_id',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-10
|
'join_key_lhs' => 'bean_id',
'join_key_rhs' => 'email_address_id',
'relationship_role_column' => 'bean_module',
'relationship_role_column_value' => $table_name,
);
$dictionary[$module]['relationships'][strtolower($table_name) . '_email_addresses_primary'] = array(
'lhs_module' => $table_name,
'lhs_table' => strtolower($table_name),
'lhs_key' => 'id',
'rhs_module' => 'EmailAddresses',
'rhs_table' => 'email_addresses',
'rhs_key' => 'id',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-11
|
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'email_addr_bean_rel',
'join_key_lhs' => 'bean_id',
'join_key_rhs' => 'email_address_id',
'relationship_role_column' => 'bean_module',
'relationship_role_column_value' => $module,
'primary_flag_column' => 'primary_address',
);
Creating a Custom Bean and Modifying the Save Function
Next step, you will need to create a custom bean that extends from the stock bean. In our example, we choose the Opportunities.Â
./custom/modules/Opportunities/CustomOpportunity.php
<?php
class CustomOpportunity extends Opportunity
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-12
|
<?php
class CustomOpportunity extends Opportunity
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->emailAddress = BeanFactory::newBean('EmailAddresses');
}
/**
* Populate email address fields here instead of retrieve() so that they are properly available for logic hooks
*
* @see parent::fill_in_relationship_fields()
*/
public function fill_in_relationship_fields()
{
parent::fill_in_relationship_fields();
$this->emailAddress->handleLegacyRetrieve($this);
}
/**
* @see parent::get_list_view_data()
*/
public function get_list_view_data()
{
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-13
|
*/
public function get_list_view_data()
{
global $current_user;
$temp_array = $this->get_list_view_array();
$temp_array['EMAIL'] = $this->emailAddress->getPrimaryAddress($this);
// Fill in the email1 field only if the user has access to it
// This is a special case, because getEmailLink() uses email1 field for making the link
// Otherwise get_list_view_data() shouldn't set any fields except fill the template data
if ($this->ACLFieldAccess('email1', 'read')) {
$this->email1 = $temp_array['EMAIL'];
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-14
|
$this->email1 = $temp_array['EMAIL'];
}
$temp_array['EMAIL_LINK'] = $current_user->getEmailLink('email1', $this, '', '', 'ListView');
return $temp_array;
}
/**
*
* @see parent::save()
*/
public function save($check_notify = false)
{
if (static::inOperation('saving_related')) {
parent::save($check_notify);
return $this;
}
$ori_in_workflow = empty($this->in_workflow) ? false : true;
$this->emailAddress->handleLegacySave($this, $this->module_dir);
parent::save($check_notify);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-15
|
parent::save($check_notify);
$override_email = array();
if (!empty($this->email1_set_in_workflow)) {
$override_email['emailAddress0'] = $this->email1_set_in_workflow;
}
if (!empty($this->email2_set_in_workflow)) {
$override_email['emailAddress1'] = $this->email2_set_in_workflow;
}
if (!isset($this->in_workflow)) {
$this->in_workflow = false;
}
if ($ori_in_workflow === false || !empty($override_email)) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-16
|
$result = $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '',
$this->in_workflow);
}
return $this;
}
}
Replacing the Stock Bean with a Custom Bean
Once you created the custom bean, you will need to show Sugar to use Custom bean. To do that you will create ./custom/modules/<modulename>/<modulename>.php and update the class name and file path in the $beanList and $beanFiles. (See: Modules $beanList and Customizing Core SugarBeans)
custom/Extension/application/Ext/Include/customOpportunities.php
<?php
$objectList['Opportunities'] = 'Opportunity';
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-17
|
<?php
$objectList['Opportunities'] = 'Opportunity';
$beanList['Opportunities'] = 'CustomOpportunity';
$beanFiles['CustomOpportunity'] = 'custom/modules/Opportunities/CustomOpportunity.php';
Once you have created these files, you will need to navigate Admin > Repairs and perform Quick Repair and Rebuild.
Adding the Emails Field to the Record View
At the stage, you have already created the field and updated the bean. The last step is placing the email field to record view. You can perform this step using Studio. Once you navigate to Studio you will find an Email field on the left column where available fields are listed. After adding the field the record views of Opportunities will look like this:
./custom/modules/Opportunities/clients/base/views/record/record.php
<?php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-18
|
<?php
$viewdefs['Opportunities'] =
array (
'base' =>
array (
'view' =>
array (
'record' =>
array (
'buttons' =>
array (
0 =>
array (
'type' => 'button',
'name' => 'cancel_button',
'label' => 'LBL_CANCEL_BUTTON_LABEL',
'css_class' => 'btn-invisible btn-link',
'showOn' => 'edit',
'events' =>
array (
'click' => 'button:cancel_button:click',
),
),
1 =>
array (
'type' => 'rowaction',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-19
|
1 =>
array (
'type' => 'rowaction',
'event' => 'button:save_button:click',
'name' => 'save_button',
'label' => 'LBL_SAVE_BUTTON_LABEL',
'css_class' => 'btn btn-primary',
'showOn' => 'edit',
'acl_action' => 'edit',
),
2 =>
array (
'type' => 'actiondropdown',
'name' => 'main_dropdown',
'primary' => true,
'showOn' => 'view',
'buttons' =>
array (
0 =>
array (
'type' => 'rowaction',
'event' => 'button:edit_button:click',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-20
|
'event' => 'button:edit_button:click',
'name' => 'edit_button',
'label' => 'LBL_EDIT_BUTTON_LABEL',
'acl_action' => 'edit',
),
1 =>
array (
'type' => 'shareaction',
'name' => 'share',
'label' => 'LBL_RECORD_SHARE_BUTTON',
'acl_action' => 'view',
),
2 =>
array (
'type' => 'pdfaction',
'name' => 'download-pdf',
'label' => 'LBL_PDF_VIEW',
'action' => 'download',
'acl_action' => 'view',
),
3 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-21
|
),
3 =>
array (
'type' => 'pdfaction',
'name' => 'email-pdf',
'label' => 'LBL_PDF_EMAIL',
'action' => 'email',
'acl_action' => 'view',
),
4 =>
array (
'type' => 'divider',
),
5 =>
array (
'type' => 'rowaction',
'event' => 'button:find_duplicates_button:click',
'name' => 'find_duplicates_button',
'label' => 'LBL_DUP_MERGE',
'acl_action' => 'edit',
),
6 =>
array (
'type' => 'rowaction',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-22
|
6 =>
array (
'type' => 'rowaction',
'event' => 'button:duplicate_button:click',
'name' => 'duplicate_button',
'label' => 'LBL_DUPLICATE_BUTTON_LABEL',
'acl_module' => 'Opportunities',
'acl_action' => 'create',
),
7 =>
array (
'type' => 'rowaction',
'event' => 'button:historical_summary_button:click',
'name' => 'historical_summary_button',
'label' => 'LBL_HISTORICAL_SUMMARY',
'acl_action' => 'view',
),
8 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-23
|
),
8 =>
array (
'type' => 'rowaction',
'event' => 'button:audit_button:click',
'name' => 'audit_button',
'label' => 'LNK_VIEW_CHANGE_LOG',
'acl_action' => 'view',
),
9 =>
array (
'type' => 'divider',
),
10 =>
array (
'type' => 'rowaction',
'event' => 'button:delete_button:click',
'name' => 'delete_button',
'label' => 'LBL_DELETE_BUTTON_LABEL',
'acl_action' => 'delete',
),
),
),
3 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-24
|
),
),
),
3 =>
array (
'name' => 'sidebar_toggle',
'type' => 'sidebartoggle',
),
),
'panels' =>
array (
0 =>
array (
'name' => 'panel_header',
'header' => true,
'fields' =>
array (
0 =>
array (
'name' => 'picture',
'type' => 'avatar',
'size' => 'large',
'dismiss_label' => true,
'readonly' => true,
),
1 =>
array (
'name' => 'name',
'related_fields' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-25
|
'related_fields' =>
array (
0 => 'total_revenue_line_items',
1 => 'closed_revenue_line_items',
2 => 'included_revenue_line_items',
),
),
2 =>
array (
'name' => 'favorite',
'label' => 'LBL_FAVORITE',
'type' => 'favorite',
'dismiss_label' => true,
),
3 =>
array (
'name' => 'follow',
'label' => 'LBL_FOLLOW',
'type' => 'follow',
'readonly' => true,
'dismiss_label' => true,
),
),
),
1 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-26
|
),
),
),
1 =>
array (
'name' => 'panel_body',
'label' => 'LBL_RECORD_BODY',
'columns' => 2,
'labels' => true,
'labelsOnTop' => true,
'placeholders' => true,
'newTab' => false,
'panelDefault' => 'expanded',
'fields' =>
array (
0 =>
array (
'name' => 'account_name',
'related_fields' =>
array (
0 => 'account_id',
),
),
1 =>
array (
'name' => 'date_closed',
'related_fields' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-27
|
'related_fields' =>
array (
0 => 'date_closed_timestamp',
),
),
2 =>
array (
'name' => 'amount',
'type' => 'currency',
'label' => 'LBL_LIKELY',
'related_fields' =>
array (
0 => 'amount',
1 => 'currency_id',
2 => 'base_rate',
),
'currency_field' => 'currency_id',
'base_rate_field' => 'base_rate',
'span' => 12,
),
3 =>
array (
'name' => 'best_case',
'type' => 'currency',
'label' => 'LBL_BEST',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-28
|
'label' => 'LBL_BEST',
'related_fields' =>
array (
0 => 'best_case',
1 => 'currency_id',
2 => 'base_rate',
),
'currency_field' => 'currency_id',
'base_rate_field' => 'base_rate',
),
4 =>
array (
'name' => 'worst_case',
'type' => 'currency',
'label' => 'LBL_WORST',
'related_fields' =>
array (
0 => 'worst_case',
1 => 'currency_id',
2 => 'base_rate',
),
'currency_field' => 'currency_id',
'base_rate_field' => 'base_rate',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-29
|
'base_rate_field' => 'base_rate',
),
5 =>
array (
'name' => 'tag',
'span' => 6,
),
6 =>
array (
'name' => 'sales_status',
'readonly' => true,
'studio' => true,
'label' => 'LBL_SALES_STATUS',
'span' => 6,
),
7 =>
array (
'name' => 'email',
'studio' =>
array (
'visible' => true,
'searchview' => true,
'editview' => true,
'editField' => true,
),
'label' => 'LBL_EMAIL_ADDRESS',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-30
|
),
'label' => 'LBL_EMAIL_ADDRESS',
'span' => 12,
),
),
),
2 =>
array (
'name' => 'panel_hidden',
'label' => 'LBL_RECORD_SHOWMORE',
'hide' => true,
'labelsOnTop' => true,
'placeholders' => true,
'columns' => 2,
'newTab' => false,
'panelDefault' => 'expanded',
'fields' =>
array (
0 => 'next_step',
1 => 'opportunity_type',
2 => 'lead_source',
3 => 'campaign_name',
4 =>
array (
'name' => 'description',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-31
|
4 =>
array (
'name' => 'description',
'span' => 12,
),
5 => 'assigned_user_name',
6 => 'team_name',
7 =>
array (
'name' => 'date_entered_by',
'readonly' => true,
'type' => 'fieldset',
'label' => 'LBL_DATE_ENTERED',
'fields' =>
array (
0 =>
array (
'name' => 'date_entered',
),
1 =>
array (
'type' => 'label',
'default_value' => 'LBL_BY',
),
2 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-32
|
),
2 =>
array (
'name' => 'created_by_name',
),
),
),
8 =>
array (
'name' => 'date_modified_by',
'readonly' => true,
'type' => 'fieldset',
'label' => 'LBL_DATE_MODIFIED',
'fields' =>
array (
0 =>
array (
'name' => 'date_modified',
),
1 =>
array (
'type' => 'label',
'default_value' => 'LBL_BY',
),
2 =>
array (
'name' => 'modified_by_name',
),
),
),
),
),
),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
0a667cf3ea8e-33
|
),
),
),
),
),
),
'templateMeta' =>
array (
'useTabs' => false,
),
),
),
),
);
Once the files are in place, navigate to Admin > Repair > Quick Repair & Rebuild to regenerate the metadata.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_the_Email_Field_to_a_Bean/index.html
|
2eecbdfa6f92-0
|
Adding Buttons to the Record View
Overview
This example explains how to create additional buttons on the record view and add events. We will extend and override the stock Accounts record view to add a custom button. The custom button will be called "Validate Postal Code" and ping the Zippopotamus REST service to validate the records billing state and postal code.
Steps To Complete
This tutorial requires the following steps, which are explained in the sections below:
Defining the Metadata
Adding Custom Buttons
Defining the Button Label
Extending and Overriding the Controller
Defining the Metadata
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-1
|
Extending and Overriding the Controller
Defining the Metadata
To add a button to the record view, you will first need to create the custom metadata for the view if it doesn't exist. You can easily do this by opening and saving your modules record layout in studio. Depending on your module, the path will then be ./custom/modules/<module>/clients/base/views/record/record.php. Once your file is in place, you will need to copy the button array from ./clients/base/views/record/record.php and add it to the $viewdefs['<module>']['base']['view']['record'] portion of your metadata array. An example of the button array is shown below:
'buttons' => array(
array(
'type' => 'button',
'name' => 'cancel_button',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-2
|
'name' => 'cancel_button',
'label' => 'LBL_CANCEL_BUTTON_LABEL',
'css_class' => 'btn-invisible btn-link',
'showOn' => 'edit',
),
array(
'type' => 'rowaction',
'event' => 'button:save_button:click',
'name' => 'save_button',
'label' => 'LBL_SAVE_BUTTON_LABEL',
'css_class' => 'btn btn-primary',
'showOn' => 'edit',
'acl_action' => 'edit',
),
array(
'type' => 'actiondropdown',
'name' => 'main_dropdown',
'primary' => true,
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-3
|
'name' => 'main_dropdown',
'primary' => true,
'showOn' => 'view',
'buttons' => array(
array(
'type' => 'rowaction',
'event' => 'button:edit_button:click',
'name' => 'edit_button',
'label' => 'LBL_EDIT_BUTTON_LABEL',
'acl_action' => 'edit',
),
array(
'type' => 'shareaction',
'name' => 'share',
'label' => 'LBL_RECORD_SHARE_BUTTON',
'acl_action' => 'view',
),
array(
'type' => 'pdfaction',
'name' => 'download-pdf',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-4
|
'name' => 'download-pdf',
'label' => 'LBL_PDF_VIEW',
'action' => 'download',
'acl_action' => 'view',
),
array(
'type' => 'pdfaction',
'name' => 'email-pdf',
'label' => 'LBL_PDF_EMAIL',
'action' => 'email',
'acl_action' => 'view',
),
array(
'type' => 'divider',
),
array(
'type' => 'rowaction',
'event' => 'button:find_duplicates_button:click',
'name' => 'find_duplicates_button',
'label' => 'LBL_DUP_MERGE',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-5
|
'label' => 'LBL_DUP_MERGE',
'acl_action' => 'edit',
),
array(
'type' => 'rowaction',
'event' => 'button:duplicate_button:click',
'name' => 'duplicate_button',
'label' => 'LBL_DUPLICATE_BUTTON_LABEL',
'acl_module' => $module,
),
array(
'type' => 'rowaction',
'event' => 'button:audit_button:click',
'name' => 'audit_button',
'label' => 'LNK_VIEW_CHANGE_LOG',
'acl_action' => 'view',
),
array(
'type' => 'divider',
),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-6
|
),
array(
'type' => 'divider',
),
array(
'type' => 'rowaction',
'event' => 'button:delete_button:click',
'name' => 'delete_button',
'label' => 'LBL_DELETE_BUTTON_LABEL',
'acl_action' => 'delete',
),
),
),
array(
'name' => 'sidebar_toggle',
'type' => 'sidebartoggle',
),
),
Note: When copying this array into your metadata, you will need to replace $module with the text string of your module's name.
For standard button types, the button definitions will contain the following properties:
Property
Potential Values
Description
type
button, rowaction, shareaction, actiondropdown
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-7
|
Potential Values
Description
type
button, rowaction, shareaction, actiondropdown
The widget type
name
Â
The name of the button
label
Â
The label string key for the display text of the button
css_class
Â
The CSS class to append to the button
showOn
edit, view
The ACL action of the button
For this example, we will add the custom button to the main dropdown. For actiondropdown types, there is an additional buttons array for you to specify the dropdown list of buttons. The button definitions in this array will contain the following properties:
Property
Potential Values
Description
type
button, rowaction, shareaction, actiondropdown
The widget type; Most custom buttons are 'rowaction'
event
button:button_name:click
The event name of the button
name
Â
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-8
|
button:button_name:click
The event name of the button
name
Â
The name of the button
label
Â
The label string key for the display text of the button
acl_action
 edit, view
The ACL action of the button
Adding Custom Buttons
For this example, modify the accounts' metadata to add the button definition to main_dropdown:
array(
'type' => 'rowaction',
'event' => 'button:validate_postal_code:click',
'name' => 'validate_postal_code',
'label' => 'LBL_VALIDATE_POSTAL_CODE',
'acl_action' => 'view',
),
A full example is shown below:
./custom/modules/Accounts/clients/base/views/record/record.php
<?php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-9
|
<?php
$viewdefs['Accounts'] =
array (
'base' =>
array (
'view' =>
array (
'record' =>
array (
'buttons' =>
array (
0 =>
array (
'type' => 'button',
'name' => 'cancel_button',
'label' => 'LBL_CANCEL_BUTTON_LABEL',
'css_class' => 'btn-invisible btn-link',
'showOn' => 'edit',
),
1 =>
array (
'type' => 'rowaction',
'event' => 'button:save_button:click',
'name' => 'save_button',
'label' => 'LBL_SAVE_BUTTON_LABEL',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-10
|
'label' => 'LBL_SAVE_BUTTON_LABEL',
'css_class' => 'btn btn-primary',
'showOn' => 'edit',
'acl_action' => 'edit',
),
2 =>
array (
'type' => 'actiondropdown',
'name' => 'main_dropdown',
'primary' => true,
'showOn' => 'view',
'buttons' =>
array (
0 =>
array (
'type' => 'rowaction',
'event' => 'button:edit_button:click',
'name' => 'edit_button',
'label' => 'LBL_EDIT_BUTTON_LABEL',
'acl_action' => 'edit',
),
1 =>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-11
|
'acl_action' => 'edit',
),
1 =>
array (
'type' => 'shareaction',
'name' => 'share',
'label' => 'LBL_RECORD_SHARE_BUTTON',
'acl_action' => 'view',
),
2 =>
array (
'type' => 'rowaction',
'event' => 'button:validate_postal_code:click',
'name' => 'validate_postal_code',
'label' => 'LBL_VALIDATE_POSTAL_CODE',
'acl_action' => 'view',
),
3 =>
array (
'type' => 'divider',
),
4 =>
array (
'type' => 'rowaction',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-12
|
4 =>
array (
'type' => 'rowaction',
'event' => 'button:duplicate_button:click',
'name' => 'duplicate_button',
'label' => 'LBL_DUPLICATE_BUTTON_LABEL',
'acl_module' => 'Accounts',
),
5 =>
array (
'type' => 'rowaction',
'event' => 'button:audit_button:click',
'name' => 'audit_button',
'label' => 'LNK_VIEW_CHANGE_LOG',
'acl_action' => 'view',
),
6 =>
array (
'type' => 'divider',
),
7 =>
array (
'type' => 'rowaction',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-13
|
7 =>
array (
'type' => 'rowaction',
'event' => 'button:delete_button:click',
'name' => 'delete_button',
'label' => 'LBL_DELETE_BUTTON_LABEL',
'acl_action' => 'delete',
),
),
),
3 =>
array (
'name' => 'sidebar_toggle',
'type' => 'sidebartoggle',
),
),
'panels' =>
array (
0 =>
array (
'name' => 'panel_header',
'header' => true,
'fields' =>
array (
0 =>
array (
'name' => 'picture',
'type' => 'avatar',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-14
|
'name' => 'picture',
'type' => 'avatar',
'width' => 42,
'height' => 42,
'dismiss_label' => true,
'readonly' => true,
),
1 => 'name',
2 =>
array (
'name' => 'favorite',
'label' => 'LBL_FAVORITE',
'type' => 'favorite',
'dismiss_label' => true,
),
3 =>
array (
'name' => 'follow',
'label' => 'LBL_FOLLOW',
'type' => 'follow',
'readonly' => true,
'dismiss_label' => true,
),
),
),
1 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-15
|
),
),
),
1 =>
array (
'name' => 'panel_body',
'columns' => 2,
'labelsOnTop' => true,
'placeholders' => true,
'fields' =>
array (
0 => 'website',
1 => 'industry',
2 => 'parent_name',
3 => 'account_type',
4 => 'assigned_user_name',
5 => 'phone_office',
),
),
2 =>
array (
'name' => 'panel_hidden',
'hide' => true,
'columns' => 2,
'labelsOnTop' => true,
'placeholders' => true,
'fields' =>
array (
0 =>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-16
|
'fields' =>
array (
0 =>
array (
'name' => 'fieldset_address',
'type' => 'fieldset',
'css_class' => 'address',
'label' => 'LBL_BILLING_ADDRESS',
'fields' =>
array (
0 =>
array (
'name' => 'billing_address_street',
'css_class' => 'address_street',
'placeholder' => 'LBL_BILLING_ADDRESS_STREET',
),
1 =>
array (
'name' => 'billing_address_city',
'css_class' => 'address_city',
'placeholder' => 'LBL_BILLING_ADDRESS_CITY',
),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-17
|
),
2 =>
array (
'name' => 'billing_address_state',
'css_class' => 'address_state',
'placeholder' => 'LBL_BILLING_ADDRESS_STATE',
),
3 =>
array (
'name' => 'billing_address_postalcode',
'css_class' => 'address_zip',
'placeholder' => 'LBL_BILLING_ADDRESS_POSTALCODE',
),
4 =>
array (
'name' => 'billing_address_country',
'css_class' => 'address_country',
'placeholder' => 'LBL_BILLING_ADDRESS_COUNTRY',
),
),
),
1 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-18
|
),
),
),
1 =>
array (
'name' => 'fieldset_shipping_address',
'type' => 'fieldset',
'css_class' => 'address',
'label' => 'LBL_SHIPPING_ADDRESS',
'fields' =>
array (
0 =>
array (
'name' => 'shipping_address_street',
'css_class' => 'address_street',
'placeholder' => 'LBL_SHIPPING_ADDRESS_STREET',
),
1 =>
array (
'name' => 'shipping_address_city',
'css_class' => 'address_city',
'placeholder' => 'LBL_SHIPPING_ADDRESS_CITY',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-19
|
),
2 =>
array (
'name' => 'shipping_address_state',
'css_class' => 'address_state',
'placeholder' => 'LBL_SHIPPING_ADDRESS_STATE',
),
3 =>
array (
'name' => 'shipping_address_postalcode',
'css_class' => 'address_zip',
'placeholder' => 'LBL_SHIPPING_ADDRESS_POSTALCODE',
),
4 =>
array (
'name' => 'shipping_address_country',
'css_class' => 'address_country',
'placeholder' => 'LBL_SHIPPING_ADDRESS_COUNTRY',
),
5 =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-20
|
),
5 =>
array (
'name' => 'copy',
'label' => 'NTC_COPY_BILLING_ADDRESS',
'type' => 'copy',
'mapping' =>
array (
'billing_address_street' => 'shipping_address_street',
'billing_address_city' => 'shipping_address_city',
'billing_address_state' => 'shipping_address_state',
'billing_address_postalcode' => 'shipping_address_postalcode',
'billing_address_country' => 'shipping_address_country',
),
),
),
),
2 =>
array (
'name' => 'phone_alternate',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-21
|
2 =>
array (
'name' => 'phone_alternate',
'label' => 'LBL_OTHER_PHONE',
),
3 => 'email',
4 => 'phone_fax',
5 => 'campaign_name',
6 =>
array (
'name' => 'description',
'span' => 12,
),
7 => 'sic_code',
8 => 'ticker_symbol',
9 => 'annual_revenue',
10 => 'employees',
11 => 'ownership',
12 => 'rating',
13 =>
array (
'name' => 'date_entered_by',
'readonly' => true,
'type' => 'fieldset',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-22
|
'readonly' => true,
'type' => 'fieldset',
'label' => 'LBL_DATE_ENTERED',
'fields' =>
array (
0 =>
array (
'name' => 'date_entered',
),
1 =>
array (
'type' => 'label',
'default_value' => 'LBL_BY',
),
2 =>
array (
'name' => 'created_by_name',
),
),
),
14 => 'team_name',
15 =>
array (
'name' => 'date_modified_by',
'readonly' => true,
'type' => 'fieldset',
'label' => 'LBL_DATE_MODIFIED',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-23
|
'label' => 'LBL_DATE_MODIFIED',
'fields' =>
array (
0 =>
array (
'name' => 'date_modified',
),
1 =>
array (
'type' => 'label',
'default_value' => 'LBL_BY',
),
2 =>
array (
'name' => 'modified_by_name',
),
),
'span' => 12,
),
),
),
),
'templateMeta' =>
array (
'useTabs' => false,
'tabDefs' =>
array (
'LBL_RECORD_BODY' =>
array (
'newTab' => false,
'panelDefault' => 'expanded',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-24
|
'newTab' => false,
'panelDefault' => 'expanded',
),
'LBL_RECORD_SHOWMORE' =>
array (
'newTab' => false,
'panelDefault' => 'expanded',
),
),
),
),
),
),
);
Defining the Button Label
Next, define the label for the button:
./custom/Extension/modules/Accounts/Ext/Language/en_us.validatePostalCode.php
<?php
$mod_strings['LBL_VALIDATE_POSTAL_CODE'] = 'Validate Postal Code';
Extending and Overriding the Controller
Once the button has been added to the metadata, extend and override the record view controller:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-25
|
Once the button has been added to the metadata, extend and override the record view controller:
./custom/modules/Accounts/clients/base/views/record/record.js
({
extendsFrom: 'RecordView',
zipJSON: {},
initialize: function (options) {
this._super('initialize', [options]);
//add listener for custom button
this.context.on('button:validate_postal_code:click', this.validate_postal_code, this);
},
validate_postal_code: function() {
//example of getting field data from current record
var AcctID = this.model.get('id');
var currentCity = this.model.get('billing_address_city');
var currentZip = this.model.get('billing_address_postalcode');
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-26
|
//jQuery AJAX call to Zippopotamus REST API
$.ajax({
url: 'http://api.zippopotam.us/us/' + currentZip,
success: function(data) {
this.zipJSON = data;
var city = this.zipJSON.places[0]['place name'];
if (city === currentCity)
{
app.alert.show('address-ok', {
level: 'success',
messages: 'City and Zipcode match.',
autoClose: true
});
}
else
{
app.alert.show('address-ok', {
level: 'error',
messages: 'City and Zipcode do not match.',
autoClose: false
});
}
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-27
|
autoClose: false
});
}
}
});
}
})
Once the files are in place, navigate to Admin > Repair > Quick Repair and Rebuild.
Adding Buttons without Overriding View Controllers
Sometimes your customization might need to add the same buttons to multiple views, but you don't want to overwrite other possible customizations already on the view. The following will walk through creating a custom button like the above example, add adding the buttons to views without overriding the module view controllers.
Create a Custom Button
Buttons typically come in two forms, a standard button and a 'rowaction' in an Action Menu. We can create two buttons to handle both scenarios.
./clients/base/fields/zipcode-check-button/zipcode-check-button.js
/**
* Zipcode Check button will check if zipcode matches city field
*
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-28
|
/**
* Zipcode Check button will check if zipcode matches city field
*
* @class View.Fields.Base.ZipcodeCheckButtonField
* @alias SUGAR.App.view.fields.BaseZipcodeCheckButtonField
* @extends View.Fields.Base.ButtonField
*/
({
extendsFrom: 'ButtonField',
defaultZipCodeField: 'billing_address_postalcode',
defaultCityField: 'billing_address_city',
/**
* @inheritdoc
*/
initialize: function(options) {
options.def.events = _.extend({}, options.def.events, {
'click .zip-check-btn': 'validatePostalCode'
});
this._super('initialize', [options]);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-29
|
});
this._super('initialize', [options]);
this.def.zip_code_field = _.isEmpty(this.def.zip_code_field)?this.defaultZipCodeField:this.def.zip_code_field;
this.def.city_field = _.isEmpty(this.def.city_field)?this.defaultCityField:this.def.city_field;
},
validatePostalCode: function(evt) {
var currentCity = this.model.get(this.def.city_field);
var currentZip = this.model.get(this.def.zip_code_field);
//jQuery AJAX call to Zippopotamus REST API
$.ajax({
url: 'http://api.zippopotam.us/us/' + currentZip,
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-30
|
success: function(data) {
this.zipJSON = data;
var city = this.zipJSON.places[0]['place name'];
if (city === currentCity)
{
app.alert.show('address-ok', {
level: 'success',
messages: 'City and Zipcode match.',
autoClose: true
});
}
else
{
app.alert.show('address-ok', {
level: 'error',
messages: 'City and Zipcode do not match.',
autoClose: false
});
}
}
});
}
})
./clients/base/fields/zipcode-check-rowaction/zipcode-check-rowaction.js
/**
* Zipcode Check button will check if zipcode matches city field
*
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-31
|
/**
* Zipcode Check button will check if zipcode matches city field
*
* @class View.Fields.Base.ZipcodeCheckRowactionField
* @alias SUGAR.App.view.fields.BaseZipcodeCheckRowactionField
* @extends View.Fields.Base.RowactionField
*/
({
extendsFrom: 'RowactionField',
defaultZipCodeField: 'billing_address_postalcode',
defaultCityField: 'billing_address_city',
/**
* @inheritdoc
*/
initialize: function(options) {
this._super('initialize', [options]);
this.def.zip_code_field = _.isEmpty(this.def.zip_code_field)?this.defaultZipCodeField:this.def.zip_code_field;
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-32
|
this.def.city_field = _.isEmpty(this.def.city_field)?this.defaultCityField:this.def.city_field;
},
/**
* Rowaction fields have a default event which calls rowActionSelect
*/
rowActionSelect: function(evt) {
this.validatePostalCode(evt);
},
validatePostalCode: function(evt) {
var currentCity = this.model.get(this.def.city_field);
var currentZip = this.model.get(this.def.zip_code_field);
//jQuery AJAX call to Zippopotamus REST API
$.ajax({
url: 'http://api.zippopotam.us/us/' + currentZip,
success: function(data) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-33
|
success: function(data) {
this.zipJSON = data;
var city = this.zipJSON.places[0]['place name'];
if (city === currentCity)
{
app.alert.show('address-check-msg', {
level: 'success',
messages: 'City and Zipcode match.',
autoClose: true
});
}
else
{
app.alert.show('address-check-msg', {
level: 'error',
messages: 'City and Zipcode do not match.',
autoClose: false
});
}
}
});
}
})
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-34
|
});
}
}
});
}
})
Along with the JavaScript controllers for the buttons, you can copy over the detail.hbs and edit.hbs from the base controllers that each button is extended from into each folder. The folder structure will look as follows:
./clients/base/fields/zipcode-check-button/
zipcode-check-button.js
detail.hbs
edit.hbs
./clients/base/fields/zipcode-check-rowaction/
zipcode-check-rowaction.js
detail.hbs
edit.hbs
 In the Handlebar files, you should add a custom CSS class called zip-check-btn to each of the layouts, as a way to find the elements on the page. This is also used for the ZipcodeCheckButton to isolate the event trigger. Example below:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-35
|
./cilents/base/fields/zipcode-check-button/edit.hbs
<a href="{{#if fullRoute}}#{{fullRoute}}{{else}}{{#if def.route}}#{{buildRoute context=context model=model action=def.route.action}}{{else}}javascript:void(0);{{/if}}{{/if}}"
class="btn{{#if def.primary}} btn-primary{{/if}} zip-check-btn"
{{#if def.tooltip}}
rel="tooltip"
data-placement="bottom"
title="{{str def.tooltip module}}"
{{/if}}
{{#if ariaLabel}}aria-label="{{ariaLabel}}"{{/if}}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-36
|
role="button" tabindex="{{tabIndex}}" name="{{name}}">{{#if def.icon}}<i class="fa {{def.icon}}"></i> {{/if}}{{label}}</a>
Once we have the button controllers and the templates setup, we can add the buttons to the View metadata for particular modules.
Appending Buttons to Metadata
After creating your buttons, you will need to append the buttons to the views metadata. For this, you can use the Extension Framework. The following examples will add a button to the action menu on the Accounts record view and a button to the Contacts record view. Please note that this example assumes that you have created the rowaction button above.
./custom/Extension/modules/Accounts/Ext/clients/base/views/record/addZipCodeCheckRowaction.php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-37
|
$buttons = isset($viewdefs['Accounts']['base']['view']['record']['buttons'])?$viewdefs['Accounts']['base']['view']['record']['buttons']:array();
if (!empty($buttons)) {
foreach ($buttons as $key => $button) {
if ($button['type'] == 'actiondropdown' && $button['name'] == 'main_dropdown') {
$viewdefs['Accounts']['base']['view']['record']['buttons'][$key]['buttons'][] = array(
'type' => 'divider',
);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-38
|
'type' => 'divider',
);
$viewdefs['Accounts']['base']['view']['record']['buttons'][$key]['buttons'][] = array(
'type' => 'zipcode-check-rowaction',
'event' => 'button:zipcode_check:click',
'name' => 'zipcode_check_button',
'label' => 'LBL_ZIPCODE_CHECK_BUTTON_LABEL',
'acl_action' => 'edit',
'showOn' => 'view',
);
break;
}
}
}
./custom/Extension/modules/Contacts/Ext/clients/base/views/record/addZipCodeCheckButton.php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-39
|
$buttons = isset($viewdefs['Contacts']['base']['view']['record']['buttons'])?$viewdefs['Contacts']['base']['view']['record']['buttons']:array();
$zipCodeButton = array (
'type' => 'zipcode-check-button',
'event' => 'button:zipcode_check:click',
'name' => 'zipcode_check_button',
'label' => 'LBL_ZIPCODE_CHECK_BUTTON_LABEL',
'acl_action' => 'edit',
'zip_code_field' => 'primary_address_postalcode',
'city_field' => 'primary_address_city'
);
if (!empty($buttons)){
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-40
|
);
if (!empty($buttons)){
foreach($buttons as $key => $button){
if ($button['type'] == 'actiondropdown' && $button['name'] == 'main_dropdown'){
//Get everything from this point down
$slicedBtns = array_slice($viewdefs['Contacts']['base']['view']['record']['buttons'],$key);
//Remove everything from this point down
array_splice($viewdefs['Contacts']['base']['view']['record']['buttons'],$key);
//Add Zip Code Button
$viewdefs['Contacts']['base']['view']['record']['buttons'][] = $zipCodeButton;
//Add back the buttons we removed
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-41
|
//Add back the buttons we removed
foreach($slicedBtns as $oldButton){
$viewdefs['Contacts']['base']['view']['record']['buttons'][] = $oldButton;
}
break;
}
}
} else {
$viewdefs['Contacts']['base']['view']['record']['buttons'] = array(
$zipCodeButton
);
}
unset($zipCodeButton);
The last thing that is needed now, is to define the button's label.
Defining the Button Labels
Since the button was made to work globally on multiple modules, we can define the label at the application level.
./custom/Extension/application/Ext/Language/en_us.ZipCodeCheckButton.php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
2eecbdfa6f92-42
|
$app_strings['LBL_ZIPCODE_CHECK_BUTTON_LABEL'] = 'Verify Zip Code';
 Once all files are in place, you can run a Quick Repair and Rebuild and the buttons will display and check the Zipcode fields for both the Contacts and Accounts record views without having to extend either modules RecordView controllers.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Adding_Buttons_to_the_Record_View/index.html
|
9dcdcdd83911-0
|
Dynamically Hiding Subpanels Based on Record Values
Overview
This article will demonstrate how to dynamically hide subpanels that are dependent on record values by overriding the subpanels layout for a module. This example is for an account record where we will hide the Contacts subpanel when the account type is not 'Customer'.
Example
To accomplish this, we will create a JavaScript controller that extends SubpanelsLayout. This controller will then monitor the model and control the display of the subpanels.
./custom/modules/Accounts/clients/base/layouts/subpanels/subpanels.js
Removed script tag to: https://gist.github.com/3722771.js?file=view.detail.php
({
extendsFrom: 'SubpanelsLayout',
_hiddenSubpanels: [],
initialize: function(options) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/index.html
|
9dcdcdd83911-1
|
_hiddenSubpanels: [],
initialize: function(options) {
this._super('initialize', [options]);
this.registerModelEvents();
},
/**
* Add the model change events for fields that determine when a subpanel should be hidden
*/
registerModelEvents: function(){
this.model.on('change:account_type',function(model) {
var link = 'contacts';
if (model.get('account_type') == "Customer"){
this.unhideSubpanel(link);
}else{
this.hideSubpanel(link);
}
},this);
},
/**
* Override showSubpanel to re-hide subpanels when outside changes occur, like reordering subpanel
* @inheritdoc
*/
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/index.html
|
9dcdcdd83911-2
|
* @inheritdoc
*/
showSubpanel: function(linkName) {
this._super('showSubpanel',[linkName]);
_.each(this._hiddenSubpanels, function(link) {
this.hideSubpanel(link);
},this);
},
/**
* Helper for getting the Subpanel View for a specific link
*/
getSubpanelByLink: function(link){
return this._components.find(function(component){
return component.context.get('link') === link;
});
},
/**
* Add to the _hiddenSubpanels array, and hide the subpanel
*/
hideSubpanel: function(link){
this._hiddenSubpanels.push(link);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/index.html
|
9dcdcdd83911-3
|
this._hiddenSubpanels.push(link);
var component = this.getSubpanelByLink(link);
if (!_.isUndefined(component)){
component.hide();
}
this._hiddenSubpanels = _.unique(this._hiddenSubpanels);
},
/**
* Unhide the Subpanel and remove from _hiddenSubpanels array
*/
unhideSubpanel: function(link){
var index = this._hiddenSubpanels.findIndex(function(l){
return l == link;
});
if (_.isUndefined(index)){
delete this._hiddenSubpanels[index];
}
var component = this.getSubpanelByLink(link);
if (!_.isUndefined(component)){
component.show();
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Dynamically_Hiding_Subpanels_Based_on_Record_Values/index.html
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.