AnsweredAssumed Answered

Share a javaScript function between 2 different modules

Question asked by Venkatesh Babu on Feb 20, 2018
Latest reply on Feb 26, 2018 by Venkatesh Babu


Sugar Version - 7.9

 

Have a custom JS function setDate in Products module and would want that to be shared in Quotes module. So that we can reuse the function. Tried with JS groupings and couldn't trigger the function from Quotes modules.

 

Call from Quotes modules:

this.model.on('change:field_c', this.setDate, this);


JS-Grouping: Tried with sugar_grp7.min.js:

$js_groupings[$key]['custom/Products/quote-list.js'] = 'include/javascript/sugar_grp7.min.js';
$js_groupings[$key]['custom/Quotes/record.js'] = 'include/javascript/sugar_grp7.min.js';


Tried creating new grouping.js file:

$js_groupings[$key]['custom/Products/quote-list.js'] = 'include/javascript/newGrouping.js';
$js_groupings[$key]['custom/Quotes/record.js'] = 'include/javascript/newGrouping.js';

 

Any idea would be highly appreciated.

Outcomes