and here now the two scripts:
This is working:
Route A has a transition to Tool B.
Bean in Route A
import org.joget.workflow.model.DecisionResult;
import org.joget.commons.util.LogUtil;
import org.joget.workflow.model.service.*;
String groupsRequested = "#form.account_signup.groupsRequested#";
int groupsRequestedArraySize;
String[] groupsRequestedArray = groupsRequested.split(";");
if (groupsRequested != "") {
groupsRequestedArraySize = groupsRequestedArray.length;
} else {
groupsRequestedArraySize = 0;
}
int groupCounter = Integer.valueOf("#variable.groupCounter#");
//LogUtil.info("Value of groupCounter : ", "" + groupCounter);
//LogUtil.info("Value of groupsRequested : ", groupsRequested);
//LogUtil.info("Value of groupsRequestedArray : ", Arrays.toString(groupsRequestedArray));
//LogUtil.info("Value of groupsRequestedArraySize : ", "" + groupsRequestedArraySize);
DecisionResult result = new DecisionResult();
if (groupCounter >= groupsRequestedArraySize ) {
result.addTransition("noGroupUpdate");
// LogUtil.info("Value of Transition : ", "noGroupUpdate");
} else {
result.addTransition("groupUpdate");
// LogUtil.info("Value of Transition : ", "groupUpdate");
}
result.setIsAndSplit(true);
return result;
import org.joget.commons.util.LogUtil;
import org.joget.workflow.model.service.*;
String groupsRequested = "#form.account_signup.groupsRequested#";
String[] groupsRequestedArray = groupsRequested.split(";");
int groupCounter = Integer.valueOf("#variable.groupCounter#");
//LogUtil.info("Value of groupCounter : ", "" + groupCounter);
//LogUtil.info("Value of groupsRequestedArray : ", Arrays.toString(groupsRequestedArray));
//LogUtil.info("Value of workflowAssignment : ", workflowAssignment.toString());
String group = groupsRequestedArray[groupCounter++];
WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");
wm.activityVariable(workflowAssignment.getActivityId(),"group", group);
wm.activityVariable(workflowAssignment.getActivityId(),"groupCounter", String.valueOf(groupCounter));
//LogUtil.info("Value of groupCounter : ", "" + groupCounter);
//LogUtil.info("Value of group : ", "" + group);
This is not working:
All code is in the Bean for Route A, not Tool B.
import org.joget.workflow.model.DecisionResult;
import org.joget.commons.util.LogUtil;
import org.joget.workflow.model.service.*;
String groupsRequested = "#form.account_signup.groupsRequested#";
int groupsRequestedArraySize;
int groupCounter = Integer.valueOf("#variable.groupCounter#");
String[] groupsRequestedArray = groupsRequested.split(";");
String group = groupsRequestedArray[groupCounter++];
WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");
wm.activityVariable(workflowAssignment.getActivityId(),"group", group);
// This line above throws already error since workflowAssignment is null
wm.activityVariable(workflowAssignment.getActivityId(),"groupCounter", String.valueOf(groupCounter));
if (groupsRequested != "") {
groupsRequestedArraySize = groupsRequestedArray.length;
} else {
groupsRequestedArraySize = 0;
}
int groupCounter = Integer.valueOf("#variable.groupCounter#");
//LogUtil.info("Value of groupCounter : ", "" + groupCounter);
//LogUtil.info("Value of groupsRequested : ", groupsRequested);
//LogUtil.info("Value of groupsRequestedArray : ", Arrays.toString(groupsRequestedArray));
//LogUtil.info("Value of groupsRequestedArraySize : ", "" + groupsRequestedArraySize);
DecisionResult result = new DecisionResult();
if (groupCounter >= groupsRequestedArraySize ) {
result.addTransition("noGroupUpdate");
// LogUtil.info("Value of Transition : ", "noGroupUpdate");
} else {
result.addTransition("groupUpdate");
// LogUtil.info("Value of Transition : ", "groupUpdate");
}
result.setIsAndSplit(true);
return result;