Constants
Constants can be used in conditions and filters throughout the system (for sending emails, setting value actions, defaulting dates in forms and report parameters, etc).
To add a constant
From the menu, select Designer Constants, Click New.
Field
|
Notes
|
ID and Name
|
Must be all upper case, with no spaces (underscores are acceptable); cannot start with SYS_ or PARAM_.
ID entered for the constant must be unique.
The Name is displayed to users and it can be localized.
|
Type
|
Field/data type, as used in conditions and formulas.
|
Date Format
|
Optional, this setting is only applied for Constants where Type = ‘Date’.
Note that when a Date Format is applied, the system will treat the constant as a String.
It is recommended to only specify a date format when using the Constant for making API calls (Rest Callouts or Data Imports via API) or including in email content.
|
Value
|
Define the value for the constant.
For a constant of type ‘Text’, you can define in a URL or email address, etc.
For a constant of type ‘Date’, you can define date related functions.
Please refer to examples following.
|
Value if null
|
This option is visible when Type is selected as ‘Date’.
When a constant is evaluated and it returns a null result, the system will use the date populated here, as the result for the constant.
|
Description
|
Optional, to capture more details about the constant.
|
Modifiable
|
Obsolete.
|
Visible
|
When this checkbox is selected, this constant is visible for use in conditions. This checkbox is selected by default for new constants.
|
Types
Types available for use in conditions and formulas:
Type
|
Description
|
attrib
|
Value is an object attribute or a named constant.
For example Incident Summary or SYS_TODAY
|
boolean
|
Value is boolean (yes/no, true/false).
|
date
|
Value is a date only.
|
datetime
|
Value is a date and time.
|
double
|
Value is a double.
A double is like a float (see below) but it can store larger numbers and more decimal places.
|
float
|
Value is a float (that is, a decimal such as 1.324).
|
i18n
|
Value is an internationalized value.
|
int
|
Value is an integer.
|
long
|
Value is a long.
A 'long' is like an integer but is used for very large positive or negative whole numbers, such as billions and trillions.
|
object
|
Value is an object.
For example an Incident or an Action.
|
raw
|
Value is a raw file.
For example a picture file such as a JPEG.
|
text
|
Value is text.
|
time
|
Value is a time only.
|
Examples
Numeric Value for PI
An example of a user constant for 'pi' is:
- ID: PI
- Name: Pi
- Type: double
- Value: 3.142
- Description: Pi to 3 decimal places
- Visible: "true" (checkbox is selected)
Text Constant
- ID: TEXT_CONSTANT
- Name: This is a constant for a text field
- Type: text
- Value: This is the value for the text constant
NOTE: the value is entered without any quotes - just the required string. - Description:
- Visible: "true" (checkbox is selected)
Time Constant
- ID: NINE_AM
- Name: Sets a time field to 09:00 AM
- Type: time
- Value: 09:00 am
NOTE: the value is entered without any quotes - just the required string. - Description:
- Visible: "true" (checkbox is selected)
|