hide create button v7.6

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.

2Capture.PNG

1Capture.PNG

Parents
  • 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.

Reply Children
No Data