Passing input to service task

I’m using springboot with camunda. I’ve a service task after an user task. How to pass variables from user task to service task as an input?
Service task implements a java delegate task.

Hi @JohnJ,

have a look into the documentation for Java delegates. The example in there explains how to get variables from the engine.

1 Like

Hi @JohnJ,

If you plan on using embedded forms, please check the following link in order to understand how to associate your controls with Camunda variables: https://docs.camunda.org/manual/latest/reference/embedded-forms/

After your forms have provided variables, you can simply access them like this:

String myVar = (String) execution.getVariable("myVar"); //Getting variables
execution.setVariable("myVar", "myValue"); //Setting variables

Kind Regards.

1 Like

Thanks for it. So this variables can be accessed by the flow expression also right?

For example: Here I set a value in setVariable(“role”,“ASSISTANT”) and that can be accessed in the flow expression like this ${role == ‘ASSISTANT’}. Am I right?

Exactly! :slight_smile:

But that’s not happening in my case. I’m facing this issue: “No outgoing sequence flow for the element with id ‘ConditionFlow’ could be selected for continuing the process.”

Here ConditionalFlow is a gateway which has 2 path. one path with this expression ${role == ‘ASSISTANT’} and another ${role == ‘NOT ASSISTANT’}.