also if I declare a service task to be running asynchronously by checking the “Asynchronous Before”-Box in the Asynchronous Continuations section of the service task.
I was going through the following documentation to check if maybe my configuration of the JobExecutor is wrong/different from what is written there, but this is not the case
may I ask what id you would be expecting if the boundary timer event is triggered?
The id of the user that started the process instance?
The id of the user the task was assigned to?
What if it hadn’t been assigned to any user yet?
The job executor is not related to any authenticated user, therefore the API call you use is not returning any value in case of timer execution or asynchronous continuation execution since both cases are executed by the job executor.
One option here is to store the id to a process variable when the user task is created with the help of a task listener. Whatever that id might be in your case (see questions above). In your service task you can than access this variable and retrieve the value you need no matter which path was taken.
I would expect that the method getCurrentAuthentication().getUserId() returns the id of the user which completed the previous user task in the process.
But in the end, it works with your approach to store the id of the user to a process variable.