Skip to content

Instantly share code, notes, and snippets.

@elchele
elchele / UserRoles.js
Last active Jun 20, 2016
Sidecar: Retrieving User Roles
View UserRoles.js
/* Author: Angel Magaña - cheleguanaco@cheleguanaco.com
*
* This Gist can be used within a Sugar 7 Controller to retrieve a user's
* security Roles
*
*/
/* To retrieve the Roles, we create a User object then
* retrieve the User's related Role records via the default Users <--> Roles relationship
*/
@elchele
elchele / (pre-7.2) sidebartoggle.js
Last active Aug 29, 2015
Hiding the Sugar 7 intelligence pane by default
View (pre-7.2) sidebartoggle.js
({
/* **** PRE-7.2 ONLY ****
place in /custom/modules/<Module>/clients/base/fields/sidebartoggle/ for module specific
place in /custom/clients/base/fields/sidebartoggle/ for global context */
extendsFrom: 'sidebartoggle',
/* Override existing _render method and call default toggle() method to mimic click of button to hide
the sidebar/intelligence pane */
_render: function() {
View record.js
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/Contacts/clients/base/views/record/record.js
*
* Extended RecordView controller for applying custom
* RecordView metadata at initialize time (Sugar 7.2+)
*
*/
extendsFrom: 'RecordView',
@elchele
elchele / subpanel-list.js
Created Aug 20, 2014
Custom controller for suppressing "edit" button functionality on Calls subpanel
View subpanel-list.js
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/clients/base/views/subpanel-list/subpanel-list.js
*
* Extended Subpanel List controller to suppress "Edit" functionality
* on "Calls" subpanel throughout Sugar (Sugar 7.2+)
*
*/
extendsFrom: 'SubpanelListView',
@elchele
elchele / es_test.php
Last active Jul 5, 2016
PHP script for simple querying of Elasticsearch using Sugar default server settings
View es_test.php
<?php
/* Author: Angel Magaña - cheleguanaco@cheleguanaco.com
* File: <sugar_root>/es_test.php
*
* Executes simple Elasticsearch query using
* Elasticsearch params from Sugar config files
* Usage: http://<sugar_url>/es_test.php?term=<your_search_term>
*
*/
@elchele
elchele / subpanels.js
Last active Aug 29, 2015
Subpanel layout controller to hide empty subpanels
View subpanels.js
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/clients/base/layouts/subpanels/subpanels.js
*
* Extended subpanels layout controller for hiding
* subpanels without data upon parent record load (Sugar 7.2+)
*
* This customization applies to all modules
*/
@elchele
elchele / flex-list.hbs
Last active Aug 29, 2015
Expanding the default width on the Name column
View flex-list.hbs
{{!--
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_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.
@elchele
elchele / create-actions.js
Created Oct 15, 2014
Custom controller for setting a default value on a field upon record creation
View create-actions.js
({
/* file: ./custom/modules/Accounts/clients/base/views/create-actions/create-actions.js */
extendsFrom: 'CreateView',
initialize: function(options){
this._super('initialize', [options]);
/* this is where I set the default value for a given field, in this case
it is the value 'Angel Inc.' to the 'name' field in the Accounts module.
@elchele
elchele / en_us.quota_gauge.ext.php
Last active Aug 29, 2015
Gauge for demonstrating progress towards assigned quota within current time period.
View en_us.quota_gauge.ext.php
<?php
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/Extension/application/Ext/Language/en_us.quota_gauge.ext.php
*
* labels for 'Quota Metrics' custom gauge chart for Home Dashboard
* For Sugar Ent/Ult only as it is based off RLI data
*/
$app_strings['LBL_QUOTA_GAUGE'] = 'Quota Metrics';
@elchele
elchele / record.js
Created Nov 18, 2014
Custom controller for RecordView, demonstrates dynamic required fields based on current user
View record.js
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/<Module>/clients/base/views/record/record.js
*
* Custom controller for RecordView demonstrating dynamic required attribute
* (leads module is used for the example)
*/
extendsFrom: 'RecordView',