Camunda Forms and multiple process instances - need your help for a uni-project :)

Dear Camunda Forum! Here writes a Camunda beginner and I am currently struggling with a major implementation task that I have to solve on the part of my university.

About the task
The goal is an automated travel expense report that employees can fill out on their own. For this I have to somehow manage to retrieve the necessary information through a form. According to the specification, employees should be able to include the following information in the travel expense report:

  • Cost type (select from: airplane, rental car, etc.)
  • Cost
  • travel period
    These costs should be added up automatically and depending on the travel period, the travelers are not only reimbursed for the trip, but they also receive a reimbursed amount depending on the travel period.

What I have achieved so far and what not
I have created a form in Camunda with all necessary variables. However, the process is only continuous when I want to calculate travel expenses for a single cost type. However, the goal is that the employee can call the form with the travel expenses several times - so he should be able to call different cost types several times to be able to specify the laid out costs afterwards. Can someone help me here? I need several process instances that call the same form and then also buffer them so that I can total them up afterwards?

Although it is in German - I have attached my Camunda model here. Maybe someone knows his way around. I hope someone can help me

Thanks a million!

Hi @Urlauppe
Welcome along to the forum.

I think from what i understand you’d like a user to be able to run the process that you’ve uploaded multiple times for different expenses - but be able to keep all the information about those expenses in the same context.
I think you could probably solve this problem by having one process that gathers all of the expense reports and then sends multiple messages (one for each request) to another process for processes. Then the process process that started everything can wait for the response from all processes and gather all the data together.

This examples about multi-instance messaging pretty much explains what i’m talking about. Hope that helps.

Thank you for the fast reply, I am trying it your way

Hey Niall,

thank you for your example - however I am currently struggling with inline scripting (I am using the Modeler). I keep receiving error messages when running my process. Can you maybe have a look and give me hints regarding syntax within the inline groovy scripting in Camunda?

Thanks a lot

The code I used
if (Brutto == false){
if (P19 == true){
Steuer = (Kosten / 100) * 19
}
if (P7 == true){
Steuer = (Kosten / 100) * 7
}
}

if (Brutto == true) {
if (P19 == true){
Steuer = (Kosten / 119) * 19
Kosten = (Kosten / 119) * 100
Brutto = false
}
if (P7 == true){
Steuer = (Kosten / 107) * 7
Kosten = (Kosten / 107) * 100
Brutto = false
}
}

Unfortunately, groovy is not my thing but if you want to upload the error message it might give some clues as to what is going on

Hey @Urlauppe ,

It looks like that your script is not retrieving the variables from the process context. For example you use the variable “Brutto” but it was never declared in the script. You can declare the variable and initiate the value from the process context, like below

 Boolean Brutto = execution.getVariable('Brutto')

You have to do that with all variables you are using. And if you want to use the variables in the further process you have to give the variable back to the process context by

execution.setVariable('Brutto', Brutto);

I hope that helps.
Cheers
Nele