Wherever you can enter or apply a data variable in Bonita Solution, the “Edit Expression” option gives you access to a Groovy editor to create a script.
Groovy is a scripting language with syntax similar to Java. In fact, the Groovy editor accepts Java script as well as Groovy, but if you want to streamline and simplify your code even further, Groovy is a good option.
Expressions allow you to customize the behavior of your process. You can, for example:
- define conditions on transitions;
- initialize data variables;
- configure connectors;
- and more.
Let’s have a look at the Groovy editor:
This is where you can build your expression in Groovy script. There are a few tools available in the Groovy editor.
Categories shows a list of available Groovy methods. Many of these methods are publicly available, there are also a few developed specifically for Bonita, and you can also add your own.
There is Documentation included on many of the Groovy methods.
To find a Function, enter a string in the search filter.
You can also start to enter a method directly in the editor, and the autocompletion function offers up some options.
You can choose from among the Process variables you have defined when building the expression.
When you have created an expression, you can test it by setting dummy variable values and selecting Evaluate.
The expression with the Set Variables then appears in the evaluation field.
Close the editor with OK to save the expression.
See here for more information about Groovy syntax. There’s a link included in the Groovy editor (see circled Groovy Quick Start, above).