Context Variables
Context variables hold data about the current playbook run: trigger payloads, playbook inputs, action results, assets, variables, and runtime metadata. You use them in expressions to map inputs, build conditions, and transform data.
When to Use Context Variables
Use context variables when you need to:
- Map data from a trigger into an action input (for example, $event.data.body.email)
- Reference earlier action results (for example, $actions.http_request.result.body)
- Build conditional logic (for example, $actions.lookup.status == "success")
- Use playbook inputs or variables at runtime (for example, $inputs.customerId, $variables.counter)
Using Context Variables in Expressions
Use dot notation to access properties and bracket notation for arrays or keys with special characters.
Examples:
Where you can use expressions:
- Action inputs (static value, playbook property, or expression)
- Conditions (flows, triggers, and retries)
- Transformations and scripts
Finding the Right Names and Paths
Use these spots in the UI to confirm the exact names and paths you should reference:
- Action outputs: Open the action Outputs tab to see the output schema and property names. See OutputsOutputs.
- Discovered outputs: Use Discovered Outputs when testing actions to capture runtime fields that aren't in the base schema. See Discovered Outputs and TestingDiscovered Outputs and Testing.
- Trigger schemas: The trigger configuration defines the $event.data structure for that trigger.
- Action names: Use the action name shown on the canvas as the <name> in $actions.<name>.
Context Variable Reference
Context Variables | Description | Example |
|---|---|---|
$playbook | The name of the playbook | find_iocs |
$inputs | User-defined schema of inputs for a playbook | :::BlockQuote |
"$inputs": { "some_string_playbook_input": "some_string_passed_to_the_playbook" } | | |
::: | | |
$event | Data related to the sensor event that triggered the playbook | :::BlockQuote |
Webhook "$event": { "data": { "headers": { "x-account-id": "228edce1-be3e-4b45-99d5-b4a11ac41489", "x-tenant-id": "911b9bae-540e-4064-93dc-33c1364587dd", "host": "turbine_webhook_agent_pool", "connection": "close", "authorization": "Basic U3dpbWxhbmU6YXNk", "user-agent": "PostmanRuntime/7.28.3", "accept": "*/*", "cache-control": "no-cache", "postman-token": "fc42206a-66a0-4649-9885-a16e00ab8e9d", "accept-encoding": "gzip, deflate, br" }, "url": { "hostname": "turbine_webhook_agent_pool", "href": "http://turbine_webhook_agent_pool/v1/webhook/5e60bc88-5780-42a9-8026-329fd0060d55/triggers_webhook_am9pa", "ips": [], "pathname": "/v1/webhook/5e60bc88-5780-42a9-8026-329fd0060d55/triggers_webhook_am9pa", "port": 80, "protocol": "http", "query": {} }, "method": "GET" }, "post": {}, "type": "custom_webhook", "action": "request", "fqn": "turbine.custom_webhook.request", "timestamp": 1717444327944, "sensor": { "name": "triggers_webhook_am9pa", "tags": {} }, "agent": { "name": "webhook-agent-a966253ee5a4-f975040d-f3e5-4a96-beec-bd729605537e", "tags": {} }, "tags": {} }, | | |
::: | | |
$event | Data related to the sensor event that triggered the playbook | :::BlockQuote |
Record "$event": { "data": { "application": { "id": "aXRvgAk9ufrM86LOp", "uid": "records-testing-658c9", "name": "Records Testing" }, "currentUser": { "id": "a6d44865-ed5d-4b9a-a29d-d0d3302d5629", "username": "[email protected]", "isSystemUser": false }, "record": { "id": "aN1Kk0cot6maprd0C", "url": "https://localhost:443/account/228edce1-be3e-4b45-99d5-b4a11ac41489/tenant/911b9bae-540e-4064-93dc-33c1364587dd/record/aXRvgAk9ufrM86LOp/aN1Kk0cot6maprd0C", "values": { "text": "Example", "multiline-text": "Multi line example", "radio-buttons": "option-2", "numeric": 1, "tracking-id": "ORT-9", "first-created": "2024-06-03T19:56:10.0259161Z", "last-updated": "2024-06-03T19:56:10.0606078Z" } } }, "post": {}, "type": "record", "action": "create", "fqn": "turbine.record.create", "timestamp": 1717444570268, "sensor": { "name": "turbine", "tags": {} }, "agent": { "name": "sw_api", "tags": {} }, "tags": {} } | | |
::: | | |
$event | Data related to the sensor event that triggered the playbook | :::BlockQuote |
Cron "$event": { "data": { "cron": "* * * * *" }, "post": {}, "type": "schedule", "action": "cron", "fqn": "turbine.schedule.cron", "timestamp": 1717446660290, "sensor": { "name": "turbine", "tags": {} }, "agent": { "name": "engine-local", "tags": {} }, "tags": {} } | | |
::: | | |
$event | Data related to the sensor event that triggered the playbook | :::BlockQuote |
Manual "$event": { "data": {}, "post": {}, "type": "playbook", "action": "executeTest", "fqn": "turbine.playbook.executeTest", "timestamp": 1717442522695, "sensor": { "name": "turbine", "tags": {} }, "agent": { "name": "api-local-dev", "tags": {} }, "tags": {} | | |
::: | | |
$event.data | Data/inputs from the event |
|
$event.post | Any data post-processing from the trigger |
|
$event.type | Type of event (events, sensors, schedules) |
|
$event.action | Action of the event type |
|
$event.fqn | Fully qualified event name |
|
$event.timestamp | Integer timestamp of the event in milliseconds |
|
$event.sensor.name | Name of the sensor that received the event |
|
$event.sensor.tags | Tags associated with the sensor |
|
$event.agent.name | Name of the agent that was running the sensor |
|
$event.agent.tags | Tags associated with the agent |
|
$event.tags | Tags associated with the event |
|
$trigger.name | The name of the trigger | :::BlockQuote |
Cron "$trigger": { "type": "schedules", "name": "cron" } | | |
::: | | |
$trigger.name | The name of the trigger | :::BlockQuote |
Webhook "$trigger": { "type": "sensors", "name": "triggers_webhook_acu1r" }, | | |
::: | | |
$trigger.name | The name of the trigger | :::BlockQuote |
Records "$trigger": { "type": "records", "name": "a6tgj.create" }, | | |
::: | | |
$trigger.name | The name of the trigger | :::BlockQuote |
Manual "$trigger": { "type": "events", "name": "playbook.executeTest" } | | |
::: | | |
$trigger.type | The type of trigger (events, sensors, schedules) |
|
$actions | Object containing all preceding actions that led to the current action | :::BlockQuote |
"$actions": { "some_create_variables_action_key_name": { "result": { "string_at7xg": "test", "number_ajpro": 1, "boolean_a7qe9": true, "object_a4k88": { "string_amul7": "" }, "array_afhe7": [ { "array_agz7a": [ "" ] } ], "attachment_ah5dr": null, "iterable": [ 1, 2, 0 ] }, "published": {}, "status": "success" }, "some_http_action_key_name": { "result": { "status_code": 200, "headers": { "date": "Mon, 03 Jun 2024 20:08:02 GMT", "content-type": "application/json; charset=utf-8", "content-length": "2110", "connection": "close", "etag": "W/\"83e-HiAiudLaghvV/6XO4efAJkfVWT0\"", "set-cookie": [ "sails.sid=s%3A6NN48IK2HUVfuh99U38mgwQTe3kfa9ZB.ebTIFfsxekw%2Fn8r1yME8yYz2VzJxsa7pOsv9hBFmaQk; Path=/; HttpOnly" ] }, "status_reason": "OK", "body": { "args": { "test": "1", "{\"block_1\":{\"text\":\"some text\",\"text-2\":\"more text\",\"text-list\":": { "\"text1\",\"text2\",\"text3\"": { "1,2.2,3.45,-4": { "\"one\",\"three\"": { "\"option-1\",\"option-3\"": { "\"ORT-4\"": { "[\"ORT-4\",\"ORT-5\"],\"reference-grid\":[\"ORT-4\",\"ORT-5\"]},\"block_2\":[\"text1\",\"text2\",\"text3\"],\"true\":true}": "[\"text1\",\"text2\",\"text3\"]" } } } } } } }, "headers": { "x-forwarded-proto": "https", "x-forwarded-port": "443", "host": "postman-echo.com", "x-amzn-trace-id": "Root=1-665e22a1-454ed58d1b586c896b75161a", "accept-encoding": "gzip, deflate, br" }, "url": "https://postman-echo.com/get?xxxx" } }, "published": {}, "status": "success" }, "some_loop_action": { "result": [ { "script_ac4ft": { "result": { "string_ano7f": "text1" } } }, { "script_ac4ft": { "result": { "string_ano7f": "text2" } } }, { "script_ac4ft": { "result": { "string_ano7f": "text3" } } } ], "published": {}, "status": "success" }, "$parent": { "published": {}, "status": "fail" }, "$current": { "result": { "actions": { "createVariables_atysx": { "result": { "string_awuwp": "asdf" }, "published": {}, "status": "success" } }, "published": {} }, "published": {}, "status": "success" }, "newComponent_az0s4": { "result": { "actions": { "createVariables_atysx": { "result": { "string_awuwp": "asdf" }, "published": {}, "status": "success" } }, "published": {} }, "published": {}, "status": "success" }, "7_Script": { "result": {}, "published": {}, "status": "success" }, "condition_aexis": { "result": "3", "published": {}, "status": "success" }, "transformation_alag3": { "result": { "block_1": { "text": "some text", "text-2": "more text", "text-list": [ "text1", "text2", "text3" ], "email": "[email protected]", "url": "https://swimlane.com", "rich-text": "<h3>header</h3>", "multiline-text": "multiline\ntext\ndata", "telephone": "123-345-5678", "ip": "127.0.0.1", "json": "{ \"property1\": \"value 1\", \"property2\": true }", "numeric": 123.4, "numeric-list": [ 1, 2.2, 3.45, -4 ], "single-select": "value-2", "multi-select": [ "one", "three" ], "radio-buttons": "option-2", "checkboxes": [ "option-1", "option-3" ], "date--time": "2023-11-20T10:45:03Z", "date": "2023-11-20", "timespan": "123456789", "time": "10:45:03", "usergroups": "swimlaneadmin", "reference-single": [ "ORT-4" ], "reference-multi": [ "ORT-4", "ORT-5" ], "reference-grid": [ "ORT-4", "ORT-5" ] }, "block_2": [ "text1", "text2", "text3" ], "true": true }, "published": {}, "status": "success" } }, | | |
::: | | |
$actions.<name>.result | Result of the specified action |
|
$actions.<name>.post | Posted values from the specified action |
|
$actions.<name>.status | Status of the specified action |
|
$actions.$current.result | Result of the current action (not populated until the action has run) |
|
$actions.$current.post | Posted values from the current action (not populated until the action has run) |
|
$actions.$parent.result | Result of the previous action |
|
$actions.$parent.post | Posted values from the previous action |
|
$assets | Object of asset names and their respective parameters | :::BlockQuote |
"$assets": { "vt_asset": { "url": "https://www.virustotal.com", "x-apikey": "xxx", }, | | |
::: | | |
$published | The current published object. Needed when mapping an output to an application record or to use outside of the playbook | :::BlockQuote |
"$published": { "published_body": { "access_token": "test_access_token" }, | | |
::: | | |
$repeat (deprecated) | If job is part of repeat, current iteration's key/value |
|
$loop | If job is part of a loop, current iteration's key/value | :::BlockQuote |
"$loop": { "index": 0, "key": "0", "value": "text1" }, | | |
::: | | |
$loop.index | Index of the current loop iteration |
|
$loop.key | Key of the current loop iteration |
|
$loop.value | Value of the current loop iteration |
|
$loops | If job is part of a loop or nested loop, current and nested loop iteration keys/values | :::BlockQuote |
"$loops": { "loop_aey0k": { "index": 0, "key": "0", "value": "text1" } } | | |
::: | | |
$loops.<loop_name> | Specific loop name in nested loops |
|
$loops.<loop_name>.index | Index of the specific loop iteration |
|
$loops.<loop_name>.key | Key of the specific loop iteration |
|
$loops.<loop_name>.value | Value of the specific loop iteration |
|
$variables | Current value of any variables defined upstream of this job | :::BlockQuote |
"$variables": { "string_at7xg": "new", "number_ajpro": 1, "boolean_a7qe9": true, "object_a4k88": { "string_amul7": "" }, "array_afhe7": [ { "array_agz7a": [ "" ] } ], "attachment_ah5dr": null, "iterable": [1,2,0] } | | |
::: | | |
$variables.<name> | Value of a specific variable defined upstream | :::BlockQuote |
$variables.retryCount | | |
::: | | |
Trigger-Specific Notes
- Webhook triggers: Use $event.data for headers, query parameters, and body fields from the incoming request. See Using Webhook Triggers in Swimlane TurbineUsing Webhook Triggers in Swimlane Turbine.
- Flow event triggers: $event.data matches the event data schema configured in the trigger. See Flow Event TriggerFlow Event Trigger.