Skip to content

Instantly share code, notes, and snippets.

@AjayKumar01
Last active October 3, 2016 20:33
Show Gist options
  • Save AjayKumar01/3ab9117db7c563e4f214309e333f1887 to your computer and use it in GitHub Desktop.
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
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]);
}
@AjayKumar01
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment