Skip to content

Instantly share code, notes, and snippets.

<?php
$queryParams = array(
'module' => 'Accounts',
'action' => 'DetailView',
'record' => $recordId,
);
SugarApplication::redirect('index.php?' . http_build_query($queryParams));
<?php
require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
$moduleName = 'Accounts';
$buttonCode = 'TODO';
$parser = ParserFactory::getParser("detailview", $moduleName);
$parser->_viewdefs['templateMeta']['form']['buttons']['buttonKeyCode'] = array ('customCode' => $buttonCode);
$parser->handleSave(false);
@cmourizard
cmourizard / gist:5283857
Created April 1, 2013 08:41
Getting main module for a SugarCRM page
if ( typeof(MyCustomJs) == 'undefined' ) MyCustomJs = {};
if ( typeof(MyCustomJs.Helper) == 'undefined' ) MyCustomJs.Helper = {};
MyCustomJs.Helper.getCurrentModuleName = function() {
if (typeof module_sugar_grp1 != "undefined") {
return module_sugar_grp1;
}
var url = YAHOO.util.History.getBookmarkedState('ajaxUILoc');
@cmourizard
cmourizard / SugarCRM custom form validation with UnderscoreJS.rst
Last active October 27, 2018 14:14
SugarCRM custom form validation with UnderscoreJS

Steps to add custom form validation with UnderscoreJS:

  • Step 1: Include underscoreJS and custom validation in your metadata (current example: custom/modules/Contacts/metadata/editviewdefs.php)
  • Step 2: Use _.wrap function to add your custom validation before of after Sugar original check_form function which validates the form with Sugar rules (current example: custom/modules/Contacts/js/customValidation.js)
  • Step 3: Make a Quick Repair & Rebuild :-)

Additional links:

@cmourizard
cmourizard / composer.json
Created June 26, 2013 07:13
Sugar 7 Web Service with Unirest
{
"require" : {
"mashape/unirest-php" : "dev-master"
}
}
@cmourizard
cmourizard / SugarCRM Subpanel lazy loadding.rst
Last active December 25, 2015 02:59
SugarCRM Subpanel lazy loadding
@cmourizard
cmourizard / Sugar 7 managing custom buttons
Created January 7, 2014 12:32
Managing custom buttons (render and action) with custom logic on Sugar 7
Managing custom buttons (render and action) with custom logic on Sugar 7
* Step 1: Add button to the metadata
* Step 2: Define a new field which contains:
* Rendering logic in method _render
* Action logic in method rowActionSelect
@cmourizard
cmourizard / README.md
Created July 22, 2014 20:56
Tumblr widget for Dashing

##Preview

Description

Simple Dashing widget (and associated job) to display quote from Tumblr blog. Uses Tumblr's API.

##Usage

@cmourizard
cmourizard / custom_Company_Helper_Logger.php
Created October 1, 2014 19:06
Custom SugarCRM logger to log messages in your own log file
<?php
require_once 'include/SugarLogger/SugarLogger.php';
class custom_Company_Helper_Logger extends SugarLogger
{
protected $logfile = 'company_logger';
protected $ext = '.log';
protected $dateFormat = '%c';
protected $logSize = '10MB';
@cmourizard
cmourizard / Font Awesome mapping from Sugar 7.5 to 7.6.md
Last active August 29, 2015 14:22
Font Awesome mapping from Sugar 7.5 to 7.6

Context

With the upgrade from Sugar 7.5 to Sugar 7.5, the engineering team upgrade the Font Awesome library like mentioned on post http://developer.sugarcrm.com/2015/05/28/upgrade-to-font-awesome-4-2-in-sugar-7-6/ and post http://developer.sugarcrm.com/2015/05/28/upgrade-to-font-awesome-4-2-in-sugar-7-6/

Mapping

In articles mentioned previously you can find a link the the official mapping from Fant Awesome (https://github.com/FortAwesome/Font-Awesome/wiki/Upgrading-from-3.2.1-to-4). You can also use the Administration > Styleguide section available in the application to know which icons are available.

However it's not really easy to switch and search on both page and that is the main reason about this cheat sheet. It is the migration mapping using to make some metadata (like panel-top and menu) compatible in both version: