Questions Tagged With globalvariablehttps://answers.axonivy.com/tags/globalvariable/?type=rss&user=anphunlquestions tagged <span class="tag">globalvariable</span>enFri, 03 Jan 2014 10:59:04 -0500How to change the value of global variable of a selected environment programmatically and keep the default value?https://answers.axonivy.com/questions/227/how-to-change-the-value-of-global-variable-of-a-selected-environment-programmatically-and-keep-the-default-value<p>I tried to change the value of global variable like that:</p> <pre><code>public static void updateGlobalVariableValue(final String globalName,final String globalValue,final IEnvironment environment) throws Exception { SecurityManagerFactory.getSecurityManager().executeAsSystem(new Callable&lt;Void&gt;() { @Override public Void call() throws Exception { IGlobalVariable variable = environment.findGlobalVariable(globalName); if (variable != null) { variable.setValue(globalValue); } return null; } }); } </code></pre> <p>If in the selected environment, we didn't set the value of that variable, after execute my function, the default value of the global variable is changed.</p> <p>Is it a bug of API or I did the wrong way? Could you please show me the way to modify just the value of global variable in the selected environment and keep the default value?</p> <p>Thank you very much, Phu Nguyen</p>anphunlFri, 03 Jan 2014 10:59:04 -0500https://answers.axonivy.com/questions/227/how-to-change-the-value-of-global-variable-of-a-selected-environment-programmatically-and-keep-the-default-valueglobalvariable