How can I hide the create button from popup search. not from access roles but through code
example: edit an opportunities
Account Name->Search for More
you will see Search and Select Accounts with 2 buttons Cancel Create
how to disable.
How can I hide the create button from popup search. not from access roles but through code
example: edit an opportunities
Account Name->Search for More
you will see Search and Select Accounts with 2 buttons Cancel Create
how to disable.
Hello Peter Chimienti,
Follow the below links.This should give you what you need. Let me know if you have any questions!
How to restrict Account Create In to Mobile-App sugarCRM 7.* ?
-BPATEL
Hello Bhavesh
Thanks for reply. The reason I want to hide is that the create button here does not call my controller? I already have my create-actions.js and create.js for my quickcreate. Is there another controller that I need to implement for the create in the popup to work?
Thank you in advance for your feedback.
Peter
Hi Peter,
The Search and Select Accounts, buttons cancel,create and toggle comes from view "selection-headerpane".You can make use of this view and you have to make changes in this view according to your scenario.
Copy file from /clients/base/views/selection-headerpane/selection-headerpane.js to
custom/modules/Accounts/clients/base/views/selection-headerpane/selection-headerpane.js.
I have added my logic in initialize function.In this function ,there is an array varible "buttonsToRemove".To this array you can push your button based on y. Here is executed for file your case .make use of it.
I have added custom code from line number 16 to 20.
initialize: function(options) { 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]); }
Hope this helps
Thank you Ajay. I was able to implement successfully.