Reset form fields for form used in multi-instance process

Hi all,
we use the same form in a multi-instance subprocess and we would want to reset form fields each time and not show previous values from last completed user task. What is the best way to reset these fields? We have many user tasks like this so we would want a generic approach that works for different user tasks.

Best regards,
Paul Palacean

your form fields should be pointed at Local Variables rather than process instance variables.

https://docs.camunda.org/manual/7.8/user-guide/process-engine/variables/

When you enter into a mulit-instance you are giving a collection: each instance of the mulit-instance has its own local variables, and has access to the collection item (current item in the collection) that the instance represents.

Ok, let me explain, I have a user task with 2 fields:

  • field1 which is a process instance variable set when the process starts (I want only to display its value - so ReadOnly)
  • field2 which should be a String local variable that the user should fill when completing the form.

This user task is part of a subprocess which repeats 3 times. My issue is that first time, field2 is empty on the form and I give field2=‘Text’ and complete the form, then the second time field2 has already the value ‘Text’ when I would like it to be empty. How can I achieve that?

Best regards,
Paul Palacean

You are using Generated Task form? If yes, set a Input Mapping variable with the same name as your input field (field2).

pretty sure what you are seeing is Id value in the generic form config is the variable name. When you complete the user task you are saving a process variable.

take a look at: Pattern Review: DMN Looping for Array Input use this pattern to aggregate the input results in the parent process, if you need to.

take a look at:

output.bpmn (6.6 KB)

If you remove the input variable on the user task you will see the same behaviour you described.

Hi @StephenOTT,
first of all big thanks for taking the time to create a process that maps to my question. I managed to resolve it by adding an input mapping variable with the same name and also an output mapping with the same name because I need that value in other user tasks part of the same subprocess.

I have to admit the solution is not that obvious and straight-forward.

Adding the process files for reference.
formFieldIncorrect.bpmn (7.2 KB)
formFieldCorrect.bpmn (7.4 KB)

Paul Palacean

I think you are better off to use angular task forms.