Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi,
We have got two forms. In the first form we set a workflow variable value (global1) use by a textbox. The second form we would like to set this workflow variable value to the local variable(test) in the plugin and we would like to use after in beanshell plugin script this value.
#variable.global1# working in the Launch form builder but not working in the plugin.
Like this:
String test = "#variable.global1#";
The problem no set global1 value to the test.
How can I set a workflow variable value in beanshell?
Thx. Please help.
That's the code, but not at all:
import java.util.*;
import org.apache.commons.collections.SequencedHashMap;
import java.sql.*;
import org.joget.workflow.model.service.*;
WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");
*//*String test = "SAP"; <<<< It's working
String test = "#variable.global1#"; <<<PROBLEM NOT WORKING
Map result = new SequencedHashMap();
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/wflowdb?useUnicode=true&characterEncoding=UTF-8", "--", "--"); // declare datasource
if(!con.isClosed()){
PreparedStatement stmt = con.prepareStatement("SELECT id, c_User_ID, c_Szkor_ID, c_Szkor_nev FROM formdata_Sz_gazdak WHERE c_Szolg_ID = '"test"');
PROBLEM
ResultSet rs = stmt.executeQuery();
...
return result;
5 Comments
Tiensoon
Miklos, where are you using this BeanShell Plugin? As a tool? Participant plugin? Or form variable?
Miklos Daru
Dear Tiensoon,
I use in a form variable.
Miklos Daru
When i write this parameter(#variable.global1#) to the textbox in launch workflow builder and after run. I see the good value in the textbox. So The workflow variable get a good value before.
But i would like to use this workflow variable in plugin, of course in a form.
Tiensoon
Hi Miklos, the #variable.variableName# Hash Variable can't be used in Form Variable. Technically speaking, some hash variables are dependent on assignment object, which doesn't exist in Form Variable.
The alternative is, you can use Java API to get variable value in your case. Look at the example discussed here: Getting Workflow Variable
Miklos Daru
Dear Tiensoon,
I try to use this code but not working. I make lot of screenshot from our project. Pls let see the workflow,
We are testing to 2 options but not working. We have got same problem than before.
My company are thinking change to Joget workflow manager but it was a very important for my company, we use a workflow variable, formvariable in beanshell plugin. Always we stopped because can't get a variable value. Pls looks my pictures and I will wait your answer.
Thx.