cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get all process variables in a servicetask

fan_42
Champ in-the-making
Champ in-the-making
Hi

in the last task (a service task) of my process I want to collect most of the process variables in order complete the process.

Is there an implicit or default object I could use to pass it my method?

Example:
in the modeler I would have something like that

#{myService.myMethod(processVariables)}
and my java code would look like this
public void myMethod(Map<String, Object> processVariables);

or another way I could imagine is:

#{myService.myMethod(processid)}
and my java code would look like this

public void myMethod(String processId){
    runtimeService.getVariables(processId);
}

The question is do I need to put myself the processId in the workflow variables so that I can retrieve it or is there a natural way of doing this?

Thanks
3 REPLIES 3

sky1
Champ in-the-making
Champ in-the-making
I have the same problem.

frederikherema1
Star Contributor
Star Contributor
You could just pass the execution:

#{myService.myMethod(execution)}

The execution passed is a DelegateExecution, from which you can request all variables you might need Smiley Wink

fan_42
Champ in-the-making
Champ in-the-making
Thank you frederikheremans

it was exactly what I was looking for  Smiley Very Happy