Skip to content

Instantly share code, notes, and snippets.

@AjayKumar01
AjayKumar01 / create-actions.js
Created April 9, 2016 08:39
Hiding fields in create view of module
({
/* Hiding fields in create view of opportunities module
* Ajay Kumar
* Path : custom/modules/Opportunities/clients/base/views/create-actions/create-actions.js
*/
extendsFrom: 'CreateActionsView',
initialize: function(options) {
this._super('initialize', [options]);
this.on('render', this.hideField, this);
},
@AjayKumar01
AjayKumar01 / selection-headerpane.js
Last active October 3, 2016 20:33
Removing 'Create' Button from relationship select field based on parent module and current module
initialize: function(options) {
/* Removing 'Create' Button from relationship select field based on parent module and current module
* Ajay Kumar
* Path : custom/modules/Accounts/clients/base/views/selection-headerpane/selection-headerpane.js
*/
var moduleMeta = app.metadata.getModule(options.module),
isBwcEnabled = (moduleMeta && moduleMeta.isBwcEnabled),
buttonsToRemove = [],
additionalEvents = {};
if (isBwcEnabled) {
@AjayKumar01
AjayKumar01 / record.js
Created April 9, 2016 07:41
Making field required dynamically based on condition
({
/* Making field required dynamically based on condition
* Ajay Kumar
* Path : custom/modules/Opportunities/clients/base/views/record/record.js
*/
extendsFrom: 'RecordView',
initialize: function(options) {
this._super('initialize', [options]);
this.on('render', this.testFunc, this);
this.model.on('change:probability', this.testFunc, this);
@AjayKumar01
AjayKumar01 / header.php
Created April 9, 2016 07:34
Removing import menu option from Accounts module menu.
<?php
/* Removing import menu option from Accounts module menu.
* Ajay Kumar
* Path : /custom/modules/Accounts/clients/base/menus/header/header.php.
*/
$moduleName = 'Accounts';
$viewdefs[$moduleName]['base']['menu']['header'] = array(
array(
'label' =>'LNK_NEW_ACCOUNT',
'acl_action'=>'create',
@AjayKumar01
AjayKumar01 / hidetabs.php
Created April 9, 2016 07:28
Hiding tabs using dependency in Record view
<?php
/* Hiding tabs using dependency in Record view
* Ajay Kumar
* Path : custom/Extension/modules/Opportunities/Ext/Dependencies/hidetabs.php
*/
$dependencies['Opportunities']['hide_tabs'] = array(
'hooks' => array(
"edit",
"view"
),
@AjayKumar01
AjayKumar01 / panel-top.js
Created April 9, 2016 07:24
Disabling create and link existing button action in subpanel based on parent module and parent module field value
({
/* Disabling create and link existing button action in subpanel based on parent module.
* Ajay Kumar
* Path : sugar/custom/modules/Leads/clients/base/views/panel-top/panel-top.js
*/
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var parentModule = this.context.parent.get('model').module;
var parentCollection = this.context.parent.get('collection');
@AjayKumar01
AjayKumar01 / panel-top.js
Created April 9, 2016 07:20
Disabling create and link existing button action in subpanel based on parent module.
({
/* Disabling create and link existing button action in subpanel based on parent module.
* Ajay Kumar
* Path : sugar/custom/modules/Leads/clients/base/views/panel-top/panel-top.js
*/
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var industryValue = this.context.parent.get('model').get("industry");
var parentModule = this.context.parent.get('module');
@AjayKumar01
AjayKumar01 / subpanel-list.js
Created April 9, 2016 07:15
Disabling edit button and un link button action based on parent module field value.
({
/* Disabling edit button and un link button action based on parent module field value.
* Ajay Kumar
* Path: sugar/custom/modules/Leads/clients/base/views/subpanel-list/subpanel-list.js
*/
extendsFrom: 'SubpanelListView',
initialize: function(options) {
this._super('initialize', [options]);
this.on('render', this._disableActions, this);
},
({
extendsFrom: 'RelateField',
initialize: function(options) {
this._super('initialize', [options]);
},
getFilterOptions: function(force) {
if (this._filterOptions && !force) {
return this._filterOptions;
}
//Defining our filter definitions
<?php
$mod_strings['LBL_FILTER_ACCOUNT_TEMPLATE']='Accounts without Current Account';