Hello, we’re going to use camunda in our projects. In our processes, following use case will be very frequent.
During handling user task, the client application will want to store the data filled by user. This is ok, that can be done via storing task variable functionality, where variable is POJO with all the fields user can fill.
The tricky part comes now. The data, that user fills have influence on some other data, which the user wants to see while working on the task. An on the event of the store task variable, we will need to update the computed data based on the task variable.
We could model this behaviour by user completing the task, doing the recomputations and going back to the original user task. But we don’t like this sollution, as there would be loop in nearly every user task we have. So the process would look really complicated. Also, this complete would be called very often, as business requirements are to store in every field user fills immediately, not in batches, which would result in overhead of completing the task and creating the task again in the process engine, which could have impact on performance. (longer complete execution compared to just storing the task variable, amount of history created for the process, …)
We have come up with some ideas, how we could achieve want we want, however both have drawback.
- implement own rest service for storing task variable, which would also update some other task variable.
- use aspect on storing task variable, which would update some other variable.
As we want the api to stay generic, common drawback of both these solution is, that the definition of the code, that should update the task variable coudn’t be model in the process. There would have to be some service, that would use strategy design pattern to execute correct functionality based on the user task(e.g. user task name, formKey, task variable name, …). With growing number of user task, even with good strategy implementation, it would get a little cumbersome to identify the code, which would be executing for the given task.
Is there any better way to implement our usecase? Maybe even taking advantage of some camunda feature, that we haven’t considered? Maybe creating our custom user task?