Is it possible to return process variable values after delegate execution?

Hi everyone,
we are currently considering the use of a service task with a delegate class within which we want to fetch some values and return these values inside the response to the initial api call that started the process via “…/rest/process-definition/key/processkey/start”. Inside the request body of the api call we pass some variables which we intend to update during the execution of the delegate’s execute method. Besides, the request body contains the corresponding flag for “withVariablesInReturn” : “true”. However, the response to the api request happens before any of the variables can be updated via execution.setVariable(…).

Is there something we are missing or is this use case simply not intended? Any other approaches that might help with this issue? Thanks in advance for your help!

Are you sure that the first async point in your process model is after the place where you set the variables?

Yeah, for now that’s how we have modeled it. At this point, we are assuming the model to be synchronous throughout.