Skip to content

Instantly share code, notes, and snippets.

@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');
<?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);
<?php
$queryParams = array(
'module' => 'Accounts',
'action' => 'DetailView',
'record' => $recordId,
);
SugarApplication::redirect('index.php?' . http_build_query($queryParams));