Several special variables available in Gnosis Scripts are context-sensitive and start with a dollar sign symbol.
$AppTimestamp
Gnosis Platform built timestamp.
$Base
Invoke the Expression property for the Base Item Type. The $Base variable is only valid in the Expression properties for extended Item Types.
The following is a function for an Expression for the base Item Type:
(this, a) => (
"Foo" + a
)
Then, the derived Item Type Expression property could call the $Base as a function to pass a value:
(this, a) => (
$Base(this, "Bar" + a)
)
$ClientIP
Current client IP address.
$Config
The $Config object holds the Gnosis App Configuration settings. For security reasons, the keys are unavailable for the $Config object.
To get a configuration setting value, specify the key:
$Config.AllowAnonymousLogin
In addition, the values for sub-keys (e.g., $Config.’Mail/Support’) are secure in that null will be returned. The value is only available when the configuration setting is used in Gnosis Extension Functions and when passed as the password to specific Gnosis Scripts functions:
- DocProtect
- Excel
- RestService
- Zip
$Context
All currently available variables.
$Cookies
An object containing the session cookies.
$Edit
A flag indicating the View is of type New or Update. Valid only during server-side view rendering or view state calculation.
$Error
The current Error occurred during Workflow execution. Valid only inside OnError handlers (see Sequence activity).
$Guard
The special frame evaluation guard (usually on the Solution level).
$License
Product License information.
$Item
The context Item for the current operation.
$ItemType
The context Item Type of the current operation.
$Params
Input parameters for current View or Task.
$Property
The context Property for the View State calculation and Constraint Check expressions.
$Remote
The $Remote variable is set to true when an Item is Promoted through the v1 Web API /api/Item/Promote endpoint.
Gnosis Workflow, EventHandler-type Views, and Item Type EventHandler Expression properties can check this variable to block execution or do additional logic.
$Result
The result of the executed background task. Valid only inside Callback handlers.
$ReadOnlyMode
This flag indicates that the script is running in read-only mode; thus, all non-read-only operations are prohibited. If a script attempts to change something, such as updating an Item, it terminates with an error.
Views called with the GET method are in read-only mode.
$RequestPath
The current request URL.
$ServiceMode
This flag indicates that the script is running in service mode. Operates with fewer restrictions and ignores permissions.
To enable this mode, use the ServiceMode() function.
Users with the Administrator Role can set the Service Mode for the session.
$ServerUrl
The current server URL.
$SimulationMode
This flag indicates that the script is running in simulation mode.
Simulation mode is used for debugging purposes. It permits non-read-only operations but simulates them without affecting anything.
So, updating an Item in simulation mode will succeed, but no changes will be applied after the script is finished.
- Simulation mode is available in the Scripting Console.
- Calling an Action View using the v1 View GET method will run in Simulation mode.
- Calling an Action View with the simulate=true parameter.
- To enable this mode in Script, use the Simulate() function.
$Solution or @
The target solution of the current operation (if any). (@) is the shortcut version of this variable.
$Solutions or $
Solutions are accessible to the current User (dictionary name -> Solution). ($) is the shortcut version of this variable.
$Target
The event target (string) of the current event. Valid only inside Event handlers.
$TargetView
The target view from which the rendering started (if any). Valid only during server-side view rendering.
$Task
The current background task (if any). Valid only for background task scripts.
$Transition
The current Transition of the target item. Valid only for lifecycle state transitions.
$User
The current User is responsible for the current operation. For example, the User who initiated the lifecycle state transition, changed, or requested particular item data.
$User
Returns an object:
{
"IsUser": true,
"Role": "Administrator",
"FirstName": "System",
"LastName": "Support",
"TimeZone": {
"Id": "Eastern Standard Time",
"Offset": "-05:00:00",
"Name": "(UTC-05:00) Eastern Time (US & Canada)",
"StandardName": "Eastern Standard Time",
"DaylightName": "Eastern Daylight Time",
"HasDaylight": true,
"Abbreviation": "EST"
},
"Language": "en-US",
"Id": "d82b5d94-d2c9-ee11-8e62-a841f43fb547",
"Name": "System Support"
}
$Value
The new Value of the target item property. Valid only for constraint check expressions.
$Version
Platform Version.
$View
The current View is being rendered (if any). Valid only during server-side view rendering.