cancel
Showing results for 
Search instead for 
Did you mean: 

Assign Task Local Variables in BPMN (JavaServiceTask)

jrussell_smyth
Champ in-the-making
Champ in-the-making
Is there a way to assign a task local variable for a Java ServiceTask from BPMN?

My use case is developing small reusable ServiceTasks and we would like to not have to have them know about the larger process they are running in, rather we would like to take a process level var and assign it to a task level var for use in the task.

I know this can be done programatically, but we dont really have a hook for this as we are attempting to keep the workflow assembly in bpmn.

The similar case I can find docs on is Web Service tasks with <dataInputAssociation/> or the from elements for UserTasks. I want something similar but for Java Service Tasks]

Thanks!
3 REPLIES 3

jrussell_smyth
Champ in-the-making
Champ in-the-making
To add more to what we are looking to accomplish - we want to have a single task that can be used as a single pass, or as a multi-instance, and in either case pick up the  input from the same place in the java code.

I know you can use fields and expressions to get values into your execution, but that wont work for the iterated collection in a multi-instance, so if you had a single delegate that you want to use both single-pass and multi-instance, I cant find a way to make it consistent on where it gets the input to operate upon.

Thanks again

jorell
Champ in-the-making
Champ in-the-making
Did you figure this out? We're trying to do the same thing and keep the task local assignment in the bpmn so we can have a generic task delegate.

jbarrez
Star Contributor
Star Contributor
DelegateTask has a method  Object setVariableLocal(String variableName, Object value);