Global variables are used throughout the application. They are declared in advance and are available in any business process. It is the key difference from local variables, which are available only in the business process they are declared.
Why do we need global variables?
An alternative to using global variables is to store records in the database. However, in this case, any request to the record would result in an additional request to the database. This may not be significant for small applications, but as your database grows, using globals can help reduce the load.
Keep in mind that value of a global variable is not stored in the database. It takes on the default value every time the application restarts.
Creating global variables
You can manage global variables in the Business Logic section. You will see the separate tab called Global Variables.
Here you can create new global variables and copy, modify and delete existing ones.
Global Variable Properties
- Type – can be any, including arrays, models, and model arrays.
- Name – the name of the variable.
- Description – the description of the variable.
- Read-only – specifies that the variable is read-only.
- Default Value – the ability to set a default (initial) value.
Using global variables
After creating a global variable, a new section appears in the available business process blocks list. There you can find all the global variables of your application and use them in the same way as local variables to create logic for the business process.