External Task to send process variables back to camunda process

Hi
I’m trying to send a list of strings to camunda process from an external task client developed in java and use that list further in the process.

I tried the following approach and it did not work

List failedaccounts;
Map<String, Object> variables = new HashMap<>();
variables.put(“flag”, false);
variables.put(“failedaccounts”, failedaccounts);
externalTaskService.complete(externalTask, variables);

Can I directly pass a java list back to camunda and how do I retrieve it back on the camunda side

Hi @avinashreddy,

Three versions of complete method are available.
The one you are referring to is not intended to be used when there is a need to pass variables.

Try below one
void complete(String externalTaskId, String workerId, Map<String,Object> variables)

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.13/org/camunda/bpm/engine/ExternalTaskService.html#complete-java.lang.String-java.lang.String-java.util.Map-