System constants are variables defined for the entire knowledgebase that return a value based on the system configuration. For example, the
$global.daylightServer constant returns true or false depending on whether the server is configured to account for daylight saving time. If predefined, system constants are used in read-only mode, but you can also define your own system constants and edit their settings, similar to global variables. For instance, you can create a system constant that stores a default value or file for reuse in multiple areas of the system.
System constants use the prefix
$global. A full list of system constants is available in the Global Variables tab of the Formula Help wizard.
System constants are often paired with a Script action to perform some task. For example, you could have a single script running on a server with multiple KBs that makes use of different values depending on which KB is running the script. Imagine you want a Script action that takes the values from a record in Agiloft and pushes them into an external system to generate a record there. Imagine also that each KB has its own matching external system.
To accomplish this, you might create a Text Constant global variable that provides the address of the external system on a per-KB basis, inserting the value of that variable into your script.
Create a System Constant
New system constants are created on the Customized Variables tab of the Global Variable wizard.
To create a new system constant:
- Go to Setup > System > Manage Global Variables.
- Hover over New.
- Select the type of system constant you want to create. The available types correspond to field data types, such as Choice constants, Currency constants, Text constants, File constants, and so on. The Manage Global Variables and Constants dialog appears after you make your selection.
- Configure the system constant settings as desired. Because the Manage Global Variables and Constants dialog is the same dialog used for global variables, see Edit a Global Variable for more information on the configuration settings.
- Click Finish.
If you create a new system constant and choose Yes under Supports Localization, you can save different values of the variable for different languages. Upon switching languages in the system, the variable's value is removed and you can define a new value for the chosen language.