Alternative to java class in task listener of user task

Hi Team,

I am new to Camunda. I am using a java task listener on a user task. Doing some operations on delegate object like fetching some values and modifying delegate object.

But the drawback here is, I need to deploy my java code in Camunda server which is not the requirement.

I there alternate way such that I can modify delegate object.?

One approach I was thinking to implement is, invoke rest api of my class and pass delegate variable along with it. But could not find any such thing.

It will be helpful if I can get some solution on it.

Nihir Shah

Hey @NihirShah and welcome to Camunda!
If you want to use task listeners you can either call delegates or use scripts - inline or external ones.
Another possibility would be to model the modification of your object explicit. That would result into a service task before your user task. By using the external task pattern you can then communicate with Camunda’s REST API and modify your object.
A docu to the external task pattern can be found right here:

Hopefully this was helpful for you!
All the best,

Thanks for the reply @Hafflgav…!!

My BPMN flow is very big and everywhere I used this task listener to do same operation on “create” of the task. It is not possible to add external task before each user task. Also, I cannot change user task to any other task.

Nihir Shah

Hmm… This makes it complicated.
At least I do not see any other way how to handle it in BPMN. I think delegates are the most convenient solution. Especially since you could call always the same one…

What is the operation you are performing on the creation of a user task? Maybe that’s something wich could be handled differently?

So basically, we are replacing / setting using delegateTask.setAssignee and delegateTask.addCandidateGroup. for that particular task.

Note : Candidate group and assignee available in our database.