Runtime Variables โ
The runtime layer combines session context, form metadata, registry values, and temporary state for the active form. Everything hangs off the $. root and is reached with a direct path โ for example $.self.name or $.variable.companyName.
Namespaces โ
| Namespace | Holds | Reached with |
|---|---|---|
$.self | The logged-in user's profile | $.self.email |
$.form | Metadata about the current form | $.form.name |
$.state | Temporary, script-set runtime state | $.state.ticketTitle |
$.variable | Data variables from the registry | $.variable.companyName |
$.image | Image variables from the registry | $.image.logo_h |
$.fn | Callable functions from the registry | $.fn.estimateTurnaround(โฆ) |
For where each namespace can be used, whether it is writable, and how it persists, see Variable Reference.
Session context โ $.self โ
Read-only values from the logged-in user's profile. Available in all contexts.
| Variable | Type | Example | Description |
|---|---|---|---|
$.self.id | string | 698f282f7fa272fac96bcb65 | User unique identifier |
$.self.name | string | Sean | First name |
$.self.surname | string | Davis | Last name |
$.self.fullName | string | Sean Davis | Full name |
$.self.email | string | sean.davis@example.com | Email address |
$.self.login | string | daviss | Username / login ID |
$.self.role | string | admin | Role |
$.self.theme | string | โ | Active theme ID |
$.self.language | string | en | Language preference |
$.self.timezone | string | America/New_York | Timezone preference |
Runtime state โ $.state โ
Form-scoped state set by scripts at runtime. Use it for derived values such as ticket titles and turnaround labels. State lives in memory only and is cleared on page refresh โ it is never submitted or persisted.
| Function | Returns | Description |
|---|---|---|
$state(name, value) | any | Set runtime state and return the written value. Exposed afterwards as $.state.name. Scripts only |
$state(name) | any | Read runtime state. Returns undefined if not set |
// In an On Load script: seed state from session + registry values
$state('ticketTitle', $.variable.companyName + ' / ' + $.form.name);
$state('openedBy', $.self.fullName);
// Anywhere afterwards (label, default, text, rule):
// $.state.ticketTitle
// $.state.openedBySyntax reference โ
| Context | Syntax | Notes |
|---|---|---|
| Data access | $.self.name | Direct lookups resolve in text, scripts, defaults, and labels |
| Form metadata | $.form.name | Current form id, name, url, mode, and related metadata |
| Runtime state | $.state.ticketTitle | Set with $state, read anywhere in the form |
| Registry variables | $.variable.keyName | Data variables from the registry, overridable per theme |
| Image variables | $.image.keyName | Image assets from the registry, overridable per theme (light/dark) |
| Script functions | $.fn.keyName() | Callable registry functions with read-only runtime context |
Direct paths vs. expressions
A direct path like $.self.name resolves in text, scripts, defaults, and labels. To call a helper or compute a value inside Text Display, wrap it in {{ }} โ for example {{ $sum('line_total') }}. See Variable Reference โบ Runtime caveats.
See also: Scripts overview ยท Code Helpers ยท Variable Reference
