How to start bpm add-on process from entity screen?


I’ve created new entity and screens for it, and process in BPM.
I started application, created new entity instance and I want to start process from new instance, for e.g. pressing button “Start process” from instance editor screen.

  1. How to do it?
  2. And second question - how to make automatic sequence number generation for entity instances, for e.g. CALL-001, CALL-002 etc.?

In CUBA documentation I’ve found this article about sequential number generation:
Will it work in Jmix?

Use BprocRuntimeService#startProcessInstanceById() or BprocRuntimeService#startProcessInstanceByKey().

In CUBA documentation I’ve found this article about sequential number generation

Use Sequences bean in Jmix.

1 Like

Speaking about starting processes in Jmix BPM, you should use Flowable RuntimeService for this. We haven’t add this chapter to the documentation yet, however there are few examples in the documentation GitHub issue.

Hi, Maxim @gorbunkov, thanks for examples in Github documentation.
If I have button on my entity form, how to run BPM process after pressing button?

@gorbunkov Maxim, as I see my process started as in examples, but after starting process it should be some dialog interface asking for parameters (when I start process manually, not from button code).
How to run process correctly with displaying starting dialog?


this dialog is displayed when I start the process from Process definitions:


There is a special service that creates process form screens for starting the process and for completing the task: io.jmix.bpmui.processform.ProcessFormScreens.

You can find an example of how it’s used in the Start process screen source code: io.jmix.bpmui.screen.startprocess.StartProcessScreen

    protected ProcessFormScreens processFormScreens;

    processFormScreens.createStartProcessForm(processDefinition, this)

The programmatic start by the RuntimeService allows you to fill the parameters in the source code. So if you pass the title, description and reqId parameters to the process variables map instead of param1 and param2 it will be the same as if you had started the process using the process form.