JBoss Community

Re: Getting process instance variables

created by Maciej Swiderski in jBPM - View the full discussion

alright, kind of expected this error, you should run command in this case, something like this:

 

 

Map<String, Object> variables = ksession.execute(new GenericCommand<Map<String, Object>>() {
 
            public Map<String, Object> execute(Context context) {
                StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
                ProcessInstance processInstance = (ProcessInstance) ksession.getProcessInstance(piId);
                VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
        Map<String, Object> variables = variableScope.getVariables();
                return variables;
            }
        });

HTH

Reply to this message by going to Community

Start a new discussion in jBPM at Community