Variables
Variables are dynamic key/value pairs that can be used to configure your application at runtime. By using Variables, rather than static texts, you can master the following scenarios easily:
Workflow-Application customizations (branding, multi-tenancy)
Different runtime settings (staging vs. production)
Company data (name, address, contacts)
Simple Rule Values (e.g., credit account)
To see and configure Variables at runtime, use the Engine Cockpit Variables View on the Axon Ivy Engine.
Variables Editor
Use the Variables Editor to create, delete, and edit Variables. You can import Variables from required projects to overwrite them such as hosts, user names and passwords of connector projects.
Variables Editor
Variables Tree View
Shows the Variables of the current project.
Variables Detail View
Shows the details of the selected Variable.
Name The name is the identifier of the Variable (e.g. user).
Value The value is the default value of the Variable (e.g. username for the user Variable).
Description You can add a description to explain the purpose of the Variable.
Metadata If applicable, you can specify additional metadata for a Variable:
Password: This tells the Axon Ivy Engine to encrypt the value of this Variable.
Tip
If you add a password Variable in the Axon Ivy Designer, you get a validation warning that the Variable is not encrypted. You can fix this via a Problems View > QuickFix.
Daytime: The value of this Variable is interpreted as a time of day.
Enum: You can use this option to define a list of possible values that this Variable is allowed to take on.
File: This option configures the value of this Variable to be read from an external file. This file can be a
.jsonor a.txtfile. If your Variable is calledmyFileand it should be aJSONfile, then your file must be located at<project>/config/variables/myFile.json. Alternatively, thevariablesprefix can also be part of the filename rather than a parent directory. So, the file<project>/config/variables.myFile.jsoncan contain the value for the Variable calledmyFile.
Tip
If your Variable has password or secret in its name (e.g.,
hidePasswordMenu) and no metadata option is chosen, the Axon Ivy Engine
will automatically treat this Variable as a password for increased security.
Warning
The Variables Editor interprets and formats the content of
variables.yaml. If you make manual changes to variables.yaml,
pay attention to the following points to prevent the loss of data:
Make sure the content is valid YAML.
Make sure
variables.yamlcontains exactly one top-level key with the nameVariables.Only put comments at the start or end of the file or before a Variable.
How to Access Variables
To access the Variables in your code, you can use the var method. In IvyScript, you can use the name of the Variable to get access to your defined Variables. In addition, this approach has the advantage that you receive validation notifications when a Variable is removed by a developer.
ivy.var.myVariable;
If you want to access Variable Metadata, you can also use the var
keyword. This delivers an interface. From the interface, you can get a
Variable object.
This object contains additional metadata for that Variable.
ivy.var.variable("myVariable").description();