AnsweredAssumed Answered

Common javascript for record.js file of all modules

Question asked by luuvanphong luuvanphong on Aug 20, 2015
Latest reply on Sep 11, 2015 by luuvanphong luuvanphong
Hi everyone,

I'm using Sugar 7.6 Enterprise and have something want to ask.

In my custom record.js file of module Contacts ( sugarcrm/custom/modules/Contacts/clients/base/views/record/record.js ) I write the following codes:



({    extendsFrom: 'RecordView',
    initialize: function (options) {
        app.view.invokeParent(
        this,
        {
            type: 'view',
            name: 'record',
            method: 'initialize',
            args: [options]
        }
  );

  this.model.on(
   "sync",
   function() {
    this.model.on(
     "change:last_name",
     this.onLastnameChange,
     this
    );
   },
   this
  );
    },    

onLastnameChange: function()
{
  alert('I want to have a common javascript');
},

    render: function () {
  this._super('render');
    },
})

Now I want to write a common javacript file named common.js and put onLastnameChange function into it. And this function can be called in record.js file of all modules.

Can it be?

Thanks in advance!

Outcomes