Call a java class before starting a process


Is it possible to call a java method before starting a process.

  1. Start process from camunda tasklist.
  2. And before the initial start form opens there, a java class is already called and executed some necessary actions.

How is it necessary to define this in the modeler, or maybe there is an example that would help utilize this? I have so far browsed almost all of them and didn’t find something related.

Thanks in advance!

Kind regards,


That’s not possible right now via public API extension points. You could subclass HtmlFormEngine and override its #renderStartForm method. Form engines can be exchanged via the process engine configuration properties formEngines and customFormEngines.

What’s the use case behind this question? What kind of logic would you perform in this callback and why must it happen before the form is rendered?



The logic is the following:

A user start the process. Prior to showing the form, the java method needs to read the user’s email (stored in camunda engine) and then connect to a web service and check if there is such email.

IF the emails match, the web service will return some other data for that user, which is then pre-filled in the form fields.

Thanks in advance for your help guys, you’re really quick to respond!

Hi Deniss,

if I understand your logic correctly, a Service Task right after the start event could match your requirements:

The Service Task is placed right after the Start Event and before your User Task. Like this, you should be able to execute the Java class and get all the information you need to populate the form fields for the User Task.

The only trade-off is that process instantiation and the actual start of the process are kind of separated.


1 Like


Aaaa ok. So the Start Event is then “empty”, then there is a Service Task with a call to java method and after that there is a User Task, which has the start form.

That may be very well the solution I need! I will start to implement. Thanks a lot, Andreas!

Kind regards,

Hi Deniss.

Please keep in mind that by this you already kick of a process instance before the user enters data in the form. Often you want to start a process instance not before the user klicked the button in the form.
In the latter case one possibility is to use JavaScript logic to laod data and pre-fill the form fields. With embedded forms you can embedd custom JavaScript logic which e.g. calls a REST backend by JQuery (see docs


1 Like