we have a script task in jbpm , and code is below.
java.lang.String resTmp = (java.lang.String) kcontext.getVariable("Result");
org.json.JSONArray objects = new org.json.JSONArray(resTmp);
org.json.JSONArray finalArray = new org.json.JSONArray();
for (int i = 0; i < objects.length(); i++) {
org.json.JSONObject jsonObject = objects.getJSONObject(i);
if (jsonObject.getString("card_id").equals(card_id)) {
finalArray.put(jsonObject);
}
}
kcontext.setVariable((java.lang.String)FResult, finalArray.toString());
The build is successful but we are seeing the following error while starting the workflow.
variableScopes can only resolve variable names: null
change the last line to:
kcontext.setVariable("FResult", finalArray.toString());
The setVariable()
method's first parameter is a String
, so you have to put the name your variable between double quotes (" ")