AnsweredAssumed Answered

Issue when Record.js gets Exteneded by Multiple packages

Question asked by Atif Hussain on Mar 29, 2017

Developing an install-able package for SugarCRM 7

 

 

Use Case: 

 

   I need to create an install-able package for SugarCRM On Demand instances. I need to add a couple of buttons at    the end of edit drop-down of the record view in Accounts module. As highlighted below.  

   I am using Extension Framework for this purpose. 

   Now I need to add click actions for these buttons. 

 

   Following is my code to add my actions in file

 

custom\modules\Accounts\clients\base\views\record\record.js

({
    extendsFrom:'RecordView',
    initialize:function(options){
        //add listener for custom button
        this.context.on('button:my_custom_btn:click', this.my_custom_action, this);
        this.context.on('button:my_custom_btn2:click', this.my_custom_action2, this);
   },
   my_custom_action: function() {
        // my code here
   },
   my_custom_action2: function() {
        // my code here
   }
})

 

It works fine.

 

Problem: 

The problem is that my client had purchased another package from another provider that has the exact same scenario for a different functionality. 

That package is also overriding the same file and replacing the existing file via manifest.

custom\modules\Accounts\clients\base\views\record\record.js

 

Now the custom actions of only one package works (The package which is installed later). 

I tried by moving my record.js file to below mentioned location

custom\modules\Accounts\Ext\clients\base\views\record\my_custom_accounts_record.js

In this case only actions in my package works. 

 

 

Is there any way or a suitable location where I can place my custom actions, and it don't stops the existing functionality to work ? 

 

Or a way to write my code that it appends my custom actions to the existing actions (Custom or default). 

 

need a way where the custom actions of each module can work simultaneously, either these tow or any others. 

 

 

Outcomes