cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables from Sequence Flow to Next Task using ExecutionListener

piyush_kaizen
Champ in-the-making
Champ in-the-making
How can i pass the variable from Execution Listener which is invoked for "Take" event to the next task which will be invoked due to that Sequence flow ?

It would also be helpful if I come to know the Sequence Flow ID because of which the task executed inside Task Listener.

All i want is


public class TakeEventListener implements ExecutionListener{
   @Override
   public void notify(DelegateExecution execution) throws Exception {
      // Code to set Variables for Next Task
   }
}
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi,

You can pass variables by setting a variable on the execution variable.
So execution.setVariable("someVar", "someValue");
In the next Task you can get the variable from the execution.

Best regards,

piyush_kaizen
Champ in-the-making
Champ in-the-making
I can not set process variable because Multiple Tasks would be executing concurrently.
I need a way to set Variable for that particular Task which will be executed because of that Sequence Flow

martin_grofcik
Confirmed Champ
Confirmed Champ
HI Piyush,

Can you reproduce the issue in the jUnit test? https://forums.activiti.org/content/sticky-how-write-unit-test
(e.g 2 tasks and check whether variable is set in the second one).

Regards
Martin