I little bit of a situation (maybe)... I am trying to access a variable from a ForEach loop in my process. Here is the code that seems to be called by the ForEach component:
for (Object o: collection) { String variableName = getForEachNode().getVariableName(); CompositeNodeInstance nodeInstance = (CompositeNodeInstance)((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getForEachSplitNode().getTo().getTo()); VariableScopeInstance variableScopeInstance = (VariableScopeInstance) nodeInstance.resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName); variableScopeInstance.setVariable(variableName, o); nodeInstances.add(nodeInstance); } If I am understanding this code, the variable in being set in the nodeInstance context and not the current process context. I am still getting null for my ForEach variable. I followed your example and I get null. I changed the action to do this instead... insert(context.getNodeInstance().getProcessInstance()); but I still get null values. Its like I am not looking in the correct place to find the variable. I have been looking at the JavaDocs and sources to try and resolve this without much luck. Could you give me a nudge in the right direction? When I debug the for loop above, the variableScopeInstance toString gives me WorkflowProcessInstance1 [processId=StudioSampleListener,state=1] which looks like my processInstance. But the variables HashMap is not my processes' variables, its just the ForEach variable. It seems the rule is looking at the process variables. So its like I have the wrong context. Is there another expression the action could use other than context? Thanks a bunch, Bob -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-and-process-variables-tp1616599p1632478.html Sent from the Drools - User mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users