Update business variables in Bonita 7.12


I have the following concern, depending on an option selected in the graphical interface by the user I must update only one of the two business variables represented in the attached image and not both variables at the same time.


When representing this case in a conditional structure it would look something like this:

if (condition) {
    // update businessVarA

} else {
    // update businessVarB

So, is there any way to update only one of those two business variables so that the other variable is not stored with all its null attributes in the database?

1 answer

This one is the BEST answer!


You could evaluate the condition using a BPMN Gateway and sequence flows with 2 automatic activities (one for businessVarA update and another for businessVarB)



Submitted by alexjhcm_2529035 on Wed, 05/05/2021 - 22:43

Thanks for the answer, and in the case of adding more than two business variables is it advisable to use a BPMN gateway or is there some other way to update only one of those business variables?

Submitted by romain.bioteau on Thu, 05/06/2021 - 09:00

If the variable update is conditional, yes, I recommend using a specific activity and BPMN gateways for condition evaluation.
I think it is a good practice to use the BPMN visual language as much as possible and avoid hidding the process logic in operation scripts.