Declare business variables
In order for your process to be able to perform operations on business data such as the classical create, read, update and delete operations, you need to include business variables in your process definition.
In our process we will deal with a single object: a claim. The claim object will store information about the claim itself (i.e. its description), the provided answer and a satisfaction level. To declare a business variable:
-
Select the process pool, the rectangle shape that includes start events and tasks.
-
At the bottom of the Bonita Studio screen, go to
-
Click on the Add… button next to Business variables
-
Type the name of the business variable: claim (lower case)
-
Select the Business Object: Claim
-
Click on Finish button
Now that a business variable is declared, we can use it in our transition condition definition:
-
Select the transition connecting the Satisfaction level gateway with Deal with unsatisfied customer
-
Go into the
tab -
In condition click on the pencil icon
-
Select Script in Expression type on the left hand side of the pop-up window
-
Type the Groovy script:
claim.satisfactionLevel < 3
-
Click on OK button
The script configured for the transition condition will return |
Our business variable is never initialized so it will remain empty. They are several different options available to initialize a business variable:
We will use the first and second options in the upcoming chapters. |
At this stage of the process definition, if you try to execute it, you will not see any difference in the process instantiation form and user task forms. Only the process overview form is different, now listing the business variable but with no associated value.
You are now ready to move to the next chapter and start collecting user inputs from forms. They will go through contracts and can finally be stored in business variables.