How to get current Task via task Listener

Hi everyone Im currently using the flowable modeler,
This scnecario:

  1. Each task should have a task listener when the task is created
  2. When the task listener invoked this listener will get the current task id and pass to a data steaming.

note: I used the “execution” as a parameter to task listener and to get the task id used the execution as a query parameter but I always get the task id from the previous task.

TIA.

Hey @dcmazing,

You can use task as a parameter to the task listener. That way you will get the current DelegateTask out of which you can get the id of the current task.

Cheers,
Filip

1 Like

@filiphr
Within my task listener of STEP 1 I am trying to set a variable that will be used in STEP 2 of the workflow. I need to set the variable – ${execution.setVariable(‘step1TaskID’, task.getTaskId())}
Could use help and example…Please

1 Like

In a task listener, you need to use ‘task’ instead of ‘execution’.

1 Like

got it thank you so much for the help @filiphr

got it thank you so much for the help @joram