Retrieve form submission as process variable

Hi,
I am trying to follow User Task Forms | docs.camunda.org in order to be able to read the parameters which was submitted via form field. The link above says something about form field key, but I can’t find such value in modeller…

When no variable exists with the same name as the form field key, then a new process variable will be created and gets the value from the submission.

So how can I have submitted value be accessable as process var?

Thank you in advance

Hey @vicmosin ,

You can find the tap for forms in the modeler here:


You can either define a form key that links to a form or you can use the form fields, where you can directly create variables in the modeler. Those will be displayed in tasklist at the user task and if a user completes the process those become process variables.

I hope that helps.
Cheers
Nele

Hi @Nele , thanks for your response.
Does it also apply for API? In other words, by submitting the form field programatically (via submitTaskForm method) will process variables be added as well?

Hi @vicmosin ,

yes this also applies for the API. So if you use complete or submit-form method you also add the variables to the process unless you mark them as local.

I hope that helps
Cheers
Nele

Ok, so something wrong with my setup…
Let me describe the steps I performed:

  1. create a user task with form field called data (of type string), no formkez specified
  2. no input/output params were added
  3. API’s submitTaskForm method is called

Expected: processes variable called data is created and can be used in expression within gateway element (in bpmn)
Actual: no variable called data created, no way of using user input as expression.

Is this assumption correct or did I miss something?

Thank you in advance

Hi @vicmosin ,

I just reproduced it and it works for me. I used the following model example-submitt-task-form.bpmn (4.4 KB)
I started the instance and used a REST Call to submit the form and it works and the instances is routed based on my input from the API call.

Can you maybe share more information on your case? Maybe the model itself or the API call you are doing?

Mh, ok, thanks for your example.
One thing I think I did wrong, I used ${data==..} instead of #{data==..}.
But even after fixing it, I still have no proper routing… just to make sure, did you use
FormService (Camunda Platform Javadocs 7.15.1-ee) in your example @Nele ? Maybe java impl somehow different than REST API?

@Nele I am sorry, the issue was at my side… many thanks for providing the proper syntax for expression. The issue is resolved now :slight_smile:

hey @vicmosin ,

I am glad the example helped. Normally it should not make a difference if you use # instead of $.
But most important it is working now :slight_smile:

1 Like