JBoss Community

Process Instance Variable within WorkItemHandler

created by Amin MC in jBPM - View the full discussion

Hi

 

I have a custom work item handler and I would like to load the value of a process instance variable while executing the work item handler.  Basically I have a service method which does the following:

 

public String getValue(Long processId, String variableName) {

 

  session.getProcessInstance(..);

   instance.getVariable(variableName);

 

  //do something with the value...but not modify

 

}

 

 

When i call this service method within the execute method of the work item handler I get a nullpointerexception and the stacktrace indicates that the processinstancebytearray value of ProcessInstanceInfo is null. I guess this is because the process has not reached a safe point to persist.  Is there another way to get the value of a variable defined in the process within the execution of the work item handler?

 

This is the final part of a POC I am currently working on demonstrating the use of JBPM 5 so any help on this would be extremely grateful.

 

Cheers

Reply to this message by going to Community

Start a new discussion in jBPM at Community