I am lucky enough to spend most of my time working on jBPM -- and it is indeed awesome!
One approach to your problem is to switch from "pass-by-value" to "pass-by-reference" for your variable assignment. In other words, instead of passing the primitive values (String, int, etc.), you can pass an object containing these values as a parameter. If you want to retrieve the values later, you simply make sure that your code keeps a reference to the object so that you can retrieve and modify the (possibly changed) values.
This means the following:
- Making sure that the object used is in the classpath -- you need to put in the classpath of the application server or your war.
- Correctly referencing and extracting the information from your object -- whether that's in your WorkItemHandler implementation or a scriptTask.
Because of persistence, the object also needs to be serialized. Hmm.. I'll make a example of this today/tomorrow and post a link for you here.