Find a way to complete a entity edit form throught a bpm process


I’m a newer user of cuba plateform, and for the moment can do everything with in less time than ever.
Now, i’m try to use BPM process to split my orignial form in several step.
Three parts compose my dreamed form and each part should be completed by different user.
After some search on the documentation i can’t find a way to do it.
Can you tell me is there is a way for that ?

Is my question understandable?

I believe that you are looking for custom Process Form to show partial entity editor on each of your BPM task

Probably yes, but have you got any sample of how to used it ?
The documentation is not enough for me to understand this capability of cuba.

Basicly you can build screen as you normally do and implement com.haulmont.bpm.gui.form.ProcForm.
You will have something like that:

public class MyFirstStepBpmForm extends AbstractWindow implements ProcForm {
   private DataManager dataManager;

	protected Datasource<MyEntity, UUID> myEntityDs;
    @WindowParam(name = "procTask")
    protected ProcTask procTask;
    @WindowParam(name = "procInstance")
    protected ProcInstance procInstance;
    @WindowParam(name = "formDefinition", required = true)
    protected ProcFormDefinition formDefinition;
	protected UUID entityId = null;

    public void init(Map<String,Object> params){

        /* getting id of edited entity - you can pass it from BPM - model */
        entityId = UUID.fromString(this.formDefinition.getParam("editedEntityId"));
     * @return comment to be set to {@link ProcTask} instance
    public String getComment() {

     * @return a map that will be added to activiti process variables
    public Map<String, Object> getFormResult() {

Then you should follow the instructions from documentation to register that form in your application.

<?xml version="1.0" encoding="UTF-8"?>
<forms xmlns="">
    <form name="my-first-step-bpm-form " default="false">
        <param name="editedEntityId" value="entityId"/>

Hope it will help your to start.

Thanks for this sample.
The code you mention should be use at the end of a first step of a bpm process ?

Just for example. This is up to you.
Once you register your form you will be able to chose it for userTask outcome

In this combo i got only standard form choice

After restart i got a new one sorry

So i made some modification in the first bpm sample (Contact), to have to screen (edit and process).
After the first user task I change Standard form to ContractProcess (new view), and i got a exception :
Screen ‘ContractProcess’ is not defined

I can guess you type wrong screen id into bpm-form .xml file.
Sorry if i mislead you. As it sayed in docs - you need to fill screen id into forms name property (in .xml file that you register as formConfig).
You can find screen id in ‘properties’ tab into studio screen designer or in web-screens.xml file.

Ok, an other step passed.
Now, when I try to retrieve the UUID, this one is not replace by the value in params.
Do you know why ? Probably a mistake
After many test, I found a solution by inject ProInstance and use getEntity().getEntityId()
But after that I’m facing a new error :
GuiDevelopmentException: Can’t find action windowCommit. This may happen if you are opening an AbstractEditor-based screen by openWindow() method, for example from the main menu. Use openEditor() method or give the screen a name ended with ‘.edit’ to open it as editor from the main menu.

After many tests, I’m able to display the new form.
But, in my case it’s not exactly what I want to do.
Indeed, I don’t want to display a different form after user click on any button but at the beginning of each user task.
I try to explain :
From Contract Browser, click on Create (Cuba will display screen’s name contractEditorScreen_1), after the first user complete this form, he save the form and start the process (selecting controller or anything else)
The Controller user, will go to “process tasks” and open it. At this specific step, I need Cuba open an other screen with name contractEditorScreen_2 (This new editor will display fields from step 1 in readonly mode and one or more new fields form the same entity.
I hope to be more clear with that explanation.

I believe that different forms for each task it is what you need if you want that implementation came from BPM Activity Engine.
If you want different approach - there is up to you. It can be some sort of checking entity state on editor opening (eg status == ‘Step 2’) / checking if user that opened it has a task to complete in buisness-process. But i thing this is:

  1. Unclear in case of later support
  2. Has clumsy dependencies on Activity

Anyway hope i was able to provide you some help.