How to create variables in worker code?

In camunda 7 I could define “result-variables” in the bpmn digram for a service task.

Now in camunda-8 I can fetch the existing variables through the activatedJob.getVariablesAsMap method but I do I add a new java pojo object that is produced as an outcome of the worker code execution?

Thanks.

Hi @JGeek,

you can complete the task and provide result variables.

Have a look at the last line of this example: Handle variables as POJO | Camunda Platform 8

client.newCompleteCommand(job.getKey()).variables(order).send();

Hope this helps, Ingo

Thanks for the input. I will try this.

Would it have the same effect if we create an output variable in the bpmn diagram for this service task?

Thanks