How can I get value in config_override.php via js

Hi all,

I would like to get parameters in config_override.php pass into .hbs via js controller

I try with this code below but doesn't work.

var custom = app.lang.getAppListStrings('custom_value');
this.testData = custom;

then return:

[object Object]

How to do this ?

Sugarcrm 7.6

Thanks,

M

Parents
  • Hi Autchara Chaiprom,

    You can also use in the config_override.php the following:

    $sugar_config['additional_js_config']['custom_parameter'] = 'custom_value';
    

    After, you will be able to access the 'custom_parameter' with the following js code:

    App.config.custom_parameter
    

    When you initialize the js class you can also use:

    initialize: function(options) {
            this._super('initialize', [options]);
            this.custom_value = App.config.custom_value;
    }
    

    Hope this helps too.

  • Thank you both very much. Its work.

    in config_override.php

    $sugar_config['additional_js_config']['custom_parameter'] = 'custom_value';
    

    In js controller

    initialize: function(options) {  
            this._super('initialize', [options]);  
            this.custom_value = App.config.custom_parameter;  
    } 
    

    and I found that it not change value immediately when we change in config_override until we repair and rebuild.

    Is there solution for change value immediately, no need repair and rebuild ?

Reply
  • Thank you both very much. Its work.

    in config_override.php

    $sugar_config['additional_js_config']['custom_parameter'] = 'custom_value';
    

    In js controller

    initialize: function(options) {  
            this._super('initialize', [options]);  
            this.custom_value = App.config.custom_parameter;  
    } 
    

    and I found that it not change value immediately when we change in config_override until we repair and rebuild.

    Is there solution for change value immediately, no need repair and rebuild ?

Children