How to model a search form (=User task) that can work with the Process Engine?


Every time I think about this I start to use a different approach - but no one ever was fine…

The complete process models the following from an address book:

  1. enter name of person to search for in database
  2. if no one was found or a new one (for example with a different birthday) should be created do so, otherwise use the one from the list
  3. show primary data of the person (name, address, birthday, …) and the type of the contact (family, co-worker, …)
  4. depending on the type of contact show specific detail fields
  5. at the end of the process: store the data to database, create a new person entry, if necessary

Background and the parts that are already finished:

  • I want to use the Process Engine to run the model
  • the “later” parts of the process “enter/change data” is already finished and implemented by form fields in multiple user tasks (depending on what the user has chosen at in the first user task two specific user tasks with detail 1 / detail 2 are run, which specific tasks are run is decided with a simple gateway)
  • the last part of the process “store data” (as a service task implemented as a JavaDelegate) works fine, too (it reads the process variables from the fields and stores them to the data base)

Problem: It currently only works from the Cockpit (or with hard coded input data) as I have no good idea how to model the first user task: “choose person”.

The user can input multiple search data, change the search data, choose one of the search results or (even if there is a search result) decide to create a new entry.

How to model this? Using multiple user tasks in a sub-process, each using the same external form with an intermediate service task to read the data from database? If yes: how to show the multiple result in the form and how should the user decide which one to use?
I thought about using a single User Task which does all this in a single Java class as delegate, but even then I’m unsure where to define this Java class in the modeler… - and if I do this the process can likely not be called from the Cockpit application, could it?

I really hope to find a solution here…


What’s your motivation for modelling this in BPMN at all and on this fine-grained level?


The motivation is to use the process engine for as much as possible. It currently has everything in despite of the actual data handling - which is still part of the process through service tasks (java delegates). This allows the process to be run through the cockpit, too.
But I’m stuck in the part of the search form (search is in already and the java delegate returns a List - but I don’t see any option to display the list to the user and let him choose).

Any idea how to solve this or is this “out of scope” for the process engine? If it is I assume the process can be started in cockpit but when the search form user task is reached (how to model it as java delegate btw?) the process will be in wait state, I’d need to manually run the user task somehow (no idea how to do so) and afterwards I can go on with the “normal” user task that use plain camunda fields in the cockpit.


While it may be possible to build somehow, I think using BPMN and the process engine for such fine-grained user interactions (=> page flow) is not a good approach. See Chaining User Tasks to create an interactive flow (sort of a wizard style)? for a related discussion.

That said, if you want to push this forward, I would like to ask you to post your current BPMN model, delegate implementations, and forms (or a simplified version of them which focuses on your problem). Your explanations so far are not really clear to me.

If the question boils down to “How to build a task form that implements a search function for custom data?”, then my recommendation would be using an embedded form with custom javascript that creates the UI as necessary and a custom JAX-RS endpoint for the backend part of the search. I don’t think the engine APIs are suited to do that.