Last active
October 3, 2016 20:33
-
-
Save AjayKumar01/3ab9117db7c563e4f214309e333f1887 to your computer and use it in GitHub Desktop.
Removing 'Create' Button from relationship select field based on parent module and current module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
buttonsToRemove.push('create_button'); | |
} else { | |
additionalEvents['click .btn[name=create_button]'] = 'createAndSelect'; | |
this.events = _.extend({}, this.events, additionalEvents); | |
} | |
this.isMultiLink = options.context.has('recLink'); | |
if (!this.isMultiLink) { | |
buttonsToRemove.push('link_button'); | |
} | |
var parentModule = options.context.parent.attributes.module; | |
var currentModule = options.module; | |
if (_.isEqual(parentModule, "Opportunities") && _.isEqual(currentModule, "Accounts")) { | |
buttonsToRemove.push('create_button'); | |
} | |
options = this._removeButtons(options, buttonsToRemove); | |
this._super('initialize', [options]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Search and Select Accounts, buttons cancel,create and toggle comes from view "selection-headerpane.
Copy file from /clients/base/views/selection-headerpane/selection-headerpane.js to
custom/modules/Accounts/clients/base/views/selection-headerpane/selection-headerpane.js.
Line Numer 20-24 will remove create button.