Persisting variables in execution listener

I want to set some execution variables with help of a ScriptExecutionListener at the start of a service task. Although asycnhronous flag is set for the service task, the variables are not persisted. Which possibilities are there to persist variables at start of a service task?

Hi Koekeni,
Could describe your case little bit more please? How did you check whether variables are set?

Regards
Martin

Hi Martin,

I update some execution variables in execution listener: execution.setVariable(“name”, value).

Execution listener is performed, at the start of an asynchronous service task. I print the value into STDOUT. I can see the variable and it’s value in catalina.out.
But I can’t see the updated value in flowable-admin. The value is updated in flowable admin, whenever a user-task is performed or after process ends.

I understood that process state is saved into database, whenever the engine reaches an asynchronous service task or an user task. Are the execution listeners, which are attached to start event, performed, after the process state is saved into database?

Thanks in advance

The Flowable engines moves the state of a process instance from one stable state to the next one. So that’s why you see the variables only when the instance reaches an async task/user task. Both are ‘wait states’ for the engine and the data is saved to the database at that point.

Yes, at the end of the transaction. While in-flight the variables won’t be visible until the transaction is comitted.

Hi Martin,

thanks a lot for your help. I will attach execution listener to the end event of the previous sequence flow.