Update environment variable Post Processing Tool (Bean Shell Tool)

Confluence User - 01 Aug, 2020

I want to execute a delete sql as well as an increment an environment variable, I am to fetch the variable  it but dont know the syntax on how to update it ?


public Object execute(AppDefinition appDef, HttpServletRequest request) {
Connection con = null;
try {

DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
con = ds.getConnection();
FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
String envVar1= "#envVariable.cl_id#";

String testSql = "delete from app_fd_r_info where id LIKE '%,%' ";
stmtTest = con.prepareStatement(testSql);
stmtTest.executeUpdate();

}catch(Exception e) {
LogUtil.error("Sample app - Form 1", e, "Error loading user data in load binder");
} finally {
//always close the connection after used
try { if(con != null) {con.close();} } catch(SQLException e) {/* ignored */}
}
return null;
}
//call execute method with injected variable

beanshell

1


02 Aug, 2020
confluenceUser
confluenceUser

Maybe you can try to check out environmentVariableDao and its sample code at Manage Environment Variable using Form to figure out how to update environment variable value.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print