Skip to content

Instantly share code, notes, and snippets.

Angel Magaña elchele

Block or report user

Report or block elchele

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MyCustomApi.php
/* File: ./custom/clients/base/api/MyCustomApi.php */
class MyCustomApi extends SugarApi {
public function registerApiRest() {
return array(
'myCustomMethod' => array(
'reqType' => 'GET',
elchele / email.ext.php
Created Jun 26, 2019
Example on leveraging PMSE Email Template Engine and Sugar Mailer to send parsed email messages
View email.ext.php
/* File: ./custom/Extension/modules/Accounts/Ext/LogicHooks/email.ext.php */
$hook_array['after_save'][] = array(
'Send email test',
elchele / file.js
Created Jun 18, 2019
Debugging file upload issues
View file.js
/* File: ./custom/clients/base/fields/file/file.js */
extendsFrom: 'FileField',
_doValidateFileError: function(fields, errors, callback, resp) {
elchele / detail.hbs
Last active Aug 17, 2018
Custom Sidecar field component for displaying related data
View detail.hbs
/* File: ./custom/clients/base/fields/related-info/detail.hbs
* Author: Angel Magaña --
* Date: August 17, 2018
* Description: Handlebars template for related info field component
{{#each fields}}
elchele / customController.js
Created May 23, 2018
Invoking code on a successful response
View customController.js
myCustomJSMethod: function(module, guid){
//Instantiate a SugarBean object representing record identified by GUID
var beanObject =, {id:guid});
//Send request to REST v10 API to retrieve the record
//Define the anonymous function that will execute on a successful response
success: function(data){ //the data parameter represents the JSON response from the API
//Do something with the response upon successful request
elchele / CustomFilterAPI.php
Created Feb 2, 2018
Custom FilterAPI that hard codes an additional condition to the default "My Accounts" filter
View CustomFilterAPI.php
/* File: ./custom/modules/Accounts/clients/base/api/CustomFilterApi.php */
require_once 'clients/base/api/FilterApi.php';
class CustomFilterApi extends FilterApi
public function registerApiRest()
elchele / hide_panel.ext.php
Created Jan 31, 2018
Custom dependency that hides/shows a given panel on RecordView if Sales Stage is set to Closed Lost on an Opportunity
View hide_panel.ext.php
/* File: ./custom/Extension/modules/Opportunities/Ext/Dependencies/hide_panel.ext.php */
$dependencies['Opportunities']['hide_panel'] = array(
'hooks' => array("edit"),
'trigger' => 'equal($sales_stage, "Closed Lost")',
'triggerFields' => array('sales_stage'),
'onload' => true,
'actions' => array(
elchele / set_required.ext.php
Created Jan 31, 2018
Custom dependency to set a field as required based on another field's value
View set_required.ext.php
/* This example sets the Status Description field to required
if the Status field is set to 'Dead' within Leads module.
File: ./custom/Extension/modules/Leads/Ext/Dependencies/set_required.ext.php */
$dependencies['Leads']['req_status_desc_dep'] = array(
'hooks' => array("edit"),
'trigger' => 'true',
elchele / GetYTDValueExpression.php
Last active Feb 2, 2018
Custom Sugar Logic function for retrieving YTD value
View GetYTDValueExpression.php
/* File: ./custom/include/Expressions/Expression/String/GetYTDValueExpression.php */
class GetYTDValueExpression extends StringExpression
function evaluate() {
elchele / idx_user_del_vis.ext.php
Created Jan 2, 2018
Vardefs extension for Tracker index -- for versions prior to 7.7.2
View idx_user_del_vis.ext.php
/* File: ./custom/Extension/modules/Trackers/Ext/Vardefs/idx_user_del_vis.ext.php */
$dictionary['Tracker']['indices'][] = array (
'name' => 'idx_tracker_userid_del_vis',
'type' => 'index',
'fields' =>
array (
0 => 'user_id',
You can’t perform that action at this time.