--- title: "Special Variables" slug: "scripting-special-variables" tags: ["Enterprise Only"] updated: 2024-10-24T20:25:33Z published: 2024-10-24T20:25:33Z canonical: "help.agilityblue.com/scripting-special-variables" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.agilityblue.com/llms.txt > Use this file to discover all available pages before exploring further. # Special Variables There are some special variables that contain information injected into a script if the script was executed by an event trigger. ## Event Triggered Executed Special Variables The following variables are available when a script is executed by an event trigger: | Variable Name | Type | Description | | --- | --- | --- | | `$ABVAREvent` | `JObject` | Contains information about the event that triggered the script, such as the object name, the workspace id, the date/time, and the id and name of the person who triggered the script. > [!NOTE] > Tip > > This variable is provided as a `JObject` type, so use the `.ToString()` function on it to create a JSON string, which could then be piped to the `ConvertFrom-Json` cmdlet to create a PowerShell `Hashtable` object. | | `$ABVARObject` | `JObject` | The raw inbound JObject instance. The `Get-InboundObjectInstance` cmdlet converts this object for you to provide a ready-to-use PowerShell object and would be better to use in most situations. This variable may come in handy if that cmdlet happens to fail for some reason. > [!NOTE] > Tip > > This variable is provided as a `JObject` type, so use the `.ToString()` function on it to create a JSON string, which could then be piped to the `ConvertFrom-Json` cmdlet to create a PowerShell `Hashtable` object. | | `$ABVARObjectType` | `JObject` | The fully qualified type of the inbound object instance. Useful for inspecting or comparing types for triggers that may have multiple return types based on the `$ABVAREventAction` variable. > [!NOTE] > Tip > > This variable is provided as a `JObject` type, so use the `.ToString()` function on it to create a JSON string, which could then be piped to the `ConvertFrom-Json` cmdlet to create a PowerShell `Hashtable` object. | | `$ABVARScriptId` | `String` | Provides the id of the script that is currently being executed. | | `$ABVAREventAction` | `String` | Provides the event action. Some objects, like `Task`, have “sub-actions” that are stored in this variable that can be checked to determine a course of action and even require different return types in before-save trigger scenarios. Check out the tasks attached to event triggers section in the [Concepts: Tasks & Task Forms](/v1/docs/scripting-tutorials-tasks-and-task-forms) article for more details on how this variable can be used. | ## Example Usages Example script that provides output from all special variables. Note that the output will indicate that the variable is unavailable if you try to execute this script manually: ```powershell if ($null -ne $ABVAREvent) {    Write-Output "ABVAREvent is available ($($ABVAREvent.GetType()))"        $ABVAREvent.ToString()        Write-Output "" } else {    Write-Output "ABVAREvent is not available" } if ($null -ne $ABVARObject) {    Write-Output "ABVARObject is available ($($ABVARObject.GetType()))"        $ABVARObject.ToString()        Write-Output "" } else {    Write-Output "ABVARObject is not available" } if ($null -ne $ABVARObjectType) {    Write-Output "ABVARObjectType is available ($($ABVARObject.GetType()))"        $ABVARObjectType.ToString()        Write-Output "" } else {    Write-Output "ABVARObjectType is not available" } if ($null -ne $ABVARScriptId) {    Write-Output "ABVARScriptId is available ($($ABVARScriptId.GetType()))"        $ABVARScriptId        Write-Output "" } else {    Write-Output "ABVARScriptId is not available" } if ($null -ne $ABVAREventAction) {    Write-Output "ABVAREventAction is available ($($ABVAREventAction.GetType()))"        $ABVAREventAction        Write-Output "" } else {    Write-Output "ABVAREventAction is not available" } ``` Sample output: ```plaintext ABVAREvent is available (Newtonsoft.Json.Linq.JObject) {  "Payload": {    "Id": 28641,    "DisplayValue": "UPDATE"  },  "Origin": null,  "Zone": 1,  "Action": 2,  "Object": "Contact",  "WorkspaceId": 922,  "CreatedOn": "2024-10-24T19:53:55.2958292+00:00",  "CreatedBy": {    "Id": "4d004c9a-03e3-073c-0f96-b0556bf6735d",    "DisplayValue": "Taylor Thompson"  },  "Message": "Contact 'UPDATE' (28641) updated" } ABVARObject is available (Newtonsoft.Json.Linq.JObject) {  "ContactId": 28641,  "FirstName": "Aaron",  "LastName": "Gerard",  "FullName": "Aaron Gerard",  "EmailAddress": "agerratymn@merriam-webster.com",  "NameAndEmailAddress": "Aaron Gerard ",  "PhoneNumber": null,  "TimeZoneIdentifier": "Central Standard Time",  "EnableNotifications": false,  "AllowPortalAccess": false,  "IsFavorite": false,  "NumberOfProjects": 0,  "CreatedByFullName": "Taylor Thompson",  "CreatedById": "4d004c9a-03e3-073c-0f96-b0556bf6735d",  "CreatedOn": "2023-02-23T13:38:16.2183354+00:00",  "CreatedBy": null,  "LastUpdatedByFullName": "Taylor Thompson",  "LastUpdatedById": "4d004c9a-03e3-073c-0f96-b0556bf6735d",  "LastUpdatedOn": "2024-10-24T19:53:55.1653167+00:00",  "LastUpdatedBy": null,  "Fields": [] } ABVARObjectType is available (Newtonsoft.Json.Linq.JObject) AgilityBlue.ViewModels.Workspace.ContactViewModel, AgilityBlue.ViewModels, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null ABVARScriptId is available (string) a54d24fd-b120-40e7-a7bf-0487c6a8dba7 ABVAREventAction is available (string) UPDATE ```