How to Update Environment Variable of Other Application in Same Environment
I have Total 2 Application
In application 1 i am using a post Processing Tool From that Application i am inserting Data to Application 2
But application 2 also contains Id Generator counter I have to Update that id Generator Counter of Application 2 using Application 1
i have tried EnvironmentVariableDao and
getAppDefinition
public org.joget.apps.app.model.AppDefinition getAppDefinition(java.lang.String appId, java.lang.String version)
Finds the app definition based on the appId and version, cached where possible.
If version is null, empty or equals to AppDefinition.VERSION_LATEST, the latest version is returned.
but it is giving the App Definition of the Current Application only Not Working when i am passing the ID of other application.
I have Achieved How to Update the Current Application Environment Variable But not able to Update, Application2 Environment variable From Application1
import java.util.Collection;
import org.joget.apps.app.dao.EnvironmentVariableDao;
import org.joget.apps.app.model.AppDefinition;
import org.joget.apps.app.model.EnvironmentVariable;
import org.joget.apps.app.service.AppUtil;
import org.joget.apps.form.model.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.commons.util.LogUtil;
public void load() {
AppDefinition appDef = AppUtil.getCurrentAppDefinition();
if (appDef != null) {
EnvironmentVariableDao environmentVariableDao = (EnvironmentVariableDao) AppUtil.getApplicationContext().getBean("environmentVariableDao");
String envId = (String) "counter";
EnvironmentVariable e = environmentVariableDao.loadById(envId, appDef);
LogUtil.info("", e.getValue());
e.setValue("100");
environmentVariableDao.update(e);
}
}
load();