I have extended a RecordView and it works perfectly.
SugarPro/custom/modules/XXX/clients/base/views/record/record.js
({ extendsFrom: 'RecordView', initialize: function (options) { this._super('initialize',[options]); this.model.on('sync', this.changeField, this); }, changeField: function() { var temp_fields = ['active_intergrations_c']; var accountId = this.model.get("client_tech_stack_accountsaccounts_idb"); $.ajax({ url: "rest/v10/connectedappsapi/getactiveintegrations", data: { "firmId": accountId }, dataType: "json", type: "POST", success: _.bind(function (response) { if (response && response.status === "success") { if (!_.isEmpty(response.data)) { this.model.set('active_intergrations_c', response.data); } } else { app.alert.show('message-id', { level: 'info', messages: 'Unable to get Active Integrations data!.', autoClose: true }); } }, this) }); }, });
However, when I try to extend the DashletView, I find that the JavaScript is not loading. Any suggestions would be appreciated.
SugarPro/custom/modules/XXX/clients/base/views/recorddashlet/recorddashlet.js
({ extendsFrom: 'DashletView', initialize: function (options) { this._super('initialize', [options]); this.collection.on('sync', this.render, this); console.log('dashlet initialize.'); }, render: function () { this._super('render'); debugger; // Render the integration data in the dashlet var temp_fields = ['active_intergrations_c']; var accountId = this.model.get("client_tech_stack_accountsaccounts_idb"); console.log('dashlet 2'); $.ajax({ url: "rest/v10/connectedappsapi/getactiveintegrations", data: { "firmId": accountId }, dataType: "json", type: "POST", success: _.bind(function (response) { if (response && response.status === "success") { if (!_.isEmpty(response.data)) { this.model.set('active_intergrations_c', response.data); } } else { app.alert.show('message-id', { level: 'info', messages: 'Unable to get Active Integrations data!.', autoClose: true }); } }, this) }); }, });