Service Task Formula

Hello everyone!
I am really new with BPMN standard and coding, so my question may be very stupid, please be patient :smiley:

I wish to create a process that gathers information from two operators (team A and team B) and then execute some operations (ā€œEvaluation Processā€).

So I created two ā€œuser tasksā€ with Form where the operators can put variables, let say ā€œInput_Variable_TeamAā€ and ā€œInput_Variable_TeamBā€.

Fig 1

Then the output from the two user tasks will be the input in the evaluation process, that performs the operation like ā€œoutput_EvaluationProcessā€ = ā€œInput_Variable_TeamAā€ + ā€œInput_Variable_TeamBā€. So, I defined the Service Task ā€œEvaluation Processā€ with the following expression under Output section as :
value.InputVariable_TeamA + value.InputVariable_TeamB

Fig 2.

I successed to deploy and create a BP instance and the data have been correctly send to the ā€œEvaluation Processā€ task. I tested this process with value 3 and 5 for the InputVariable_TeamA and InputVariable_TeamB.

Fig 3

As you can see from Fig 3, the expression that I set didnā€™t work.
I would like that the output from the ā€œEvaluation Processā€ task gives me as result 8.

Can anyone help me out this this exercise ? or indicate me a tutorial where I can find the solution.
Thank you anticipatedly!

Fig 2

Fig 3

Hi @zzl123 and welcome to the world of BPMN,

Simply put, service tasks in Camunda 8 work as follows:

  1. When a process instance reaches the service task, a corresponding job is put on a queue
  2. External Task Workers can pick and complete these jobs
  3. Only then is the output expression evaluated

So, if you want to implement a service task, have a look at the available Clients:

Your example would work if you have a simple job worker that takes the job and completes it (without any other step).

However, in your example, you can avoid job worker completely:
Business Rule Tasks can be implemented via DMN models, which can evaluate FEEL expressions and Decisions tables. Have a look at the following:

The final DMN may look like this:
Example.dmn (2.3 KB)

2 Likes

Thank you !