# Variables

## Integration <a href="#integration" id="integration"></a>

### Identify message script <a href="#identify-message-script" id="identify-message-script"></a>

| Variable    | Type   | Description                                                                                                                                          |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log`       | Object | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                               |
| `error`     | String | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it.           |
| `payload`   | Any    | The payload string or object. Pre-processing can be configued on the Integration to automatically convert JSON to `Object` or XML to `XMLDocument2`. |
| `headers`   | Object | An object containing the request headers.                                                                                                            |
| `variables` | Object | Object used to contain Connection Variables.                                                                                                         |

### Add note script <a href="#add-note-script" id="add-note-script"></a>

| Variable    | Type   | Description                                                                                                                                          |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log`       | Object | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                               |
| `error`     | String | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it.           |
| `payload`   | Any    | The payload string or object. Pre-processing can be configued on the Integration to automatically convert JSON to `Object` or XML to `XMLDocument2`. |
| `headers`   | Object | An object containing the request headers.                                                                                                            |
| `variables` | Object | Object used to contain Connection Variables.                                                                                                         |

## Connection <a href="#connection" id="connection"></a>

### Endpoint URL <a href="#endpoint-url" id="endpoint-url"></a>

The Endpoint URL will be combined with the Path value on the Message.

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `scratchpad`  | Object      | An object that can be used to pass variables between scripts.                                                                              |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

## Message <a href="#message" id="message"></a>

### XML Template <a href="#xml-template" id="xml-template"></a>

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `scratchpad`  | Object      | An object that can be used to pass variables between scripts.                                                                              |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

### Path <a href="#path" id="path"></a>

The Path will be combined with the Endpoint URL value on the active connection.

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `scratchpad`  | Object      | An object that can be used to pass variables between scripts.                                                                              |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

### Outbound condition <a href="#outbound-condition" id="outbound-condition"></a>

{% hint style="info" %}
These variables are also available in the 'Advanced condition' script for the Outbound Trigger.
{% endhint %}

| Variable    | Type        | Description                                                                                                                                |
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`       | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`     | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`   | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `variables` | Object      | Object used to contain Connection Variables.                                                                                               |
| `current`   | GlideRecord | The record that triggers the message.  The actual table will differ between Processes.                                                     |

### Reference lookup script <a href="#reference-lookup-script" id="reference-lookup-script"></a>

| Variable    | Type        | Description                                                                                                                                          |
| ----------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log`       | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                               |
| `error`     | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it.           |
| `answer`    | Any         | The result of the script being called.                                                                                                               |
| `message`   | GlideRecord | The record of the `Message` being used.                                                                                                              |
| `request`   | GlideRecord | The record of the `HTTP Request [x_snd_eb_http_request]` being used.                                                                                 |
| `payload`   | Any         | The payload string or object. Pre-processing can be configued on the Integration to automatically convert JSON to `Object` or XML to `XMLDocument2`. |
| `variables` | Object      | Object used to contain Connection Variables.                                                                                                         |

### Extract attachments script

| Variable    | Type        | Description                                                                                                                                          |
| ----------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log`       | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                               |
| `error`     | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it.           |
| `message`   | GlideRecord | The record of the `Message` being used.                                                                                                              |
| `request`   | GlideRecord | The record of the `HTTP Request [x_snd_eb_http_request]` being used.                                                                                 |
| `payload`   | Any         | The payload string or object. Pre-processing can be configued on the Integration to automatically convert JSON to `Object` or XML to `XMLDocument2`. |
| `variables` | Object      | Object used to contain Connection Variables.                                                                                                         |

## Message Script <a href="#message-script" id="message-script"></a>

### Source to Stage (Outbound) <a href="#source-to-stage-outbound" id="source-to-stage-outbound"></a>

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                  |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `source`      | GlideRecord | The record that is being integrated.                                                                                                       |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

### Stage to Request (Outbound) <a href="#stage-to-request-outbound" id="stage-to-request-outbound"></a>

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                  |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `scratchpad`  | Object      | An object that can be used to pass variables between scripts.                                                                              |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

### Payload to Stage (Inbound) <a href="#payload-to-stage-inbound" id="payload-to-stage-inbound"></a>

| Variable      | Type        | Description                                                                                                                                          |
| ------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                               |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it.           |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                              |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                               |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                            |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                                   |
| `payload`     | Any         | The payload string or object. Pre-processing can be configued on the Integration to automatically convert JSON to `Object` or XML to `XMLDocument2`. |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                                         |

### Stage to Target (Inbound) <a href="#stage-to-target-inbound" id="stage-to-target-inbound"></a>

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                  |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `target`      | GlideRecord | The record that is being integrated.                                                                                                       |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

## Field <a href="#field" id="field"></a>

### Default inbound <a href="#default-inbound" id="default-inbound"></a>

During operation, Stage to Target Message Script variables will apply.

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                  |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `target`      | GlideRecord | The record that is being integrated.                                                                                                       |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

### Default outbound <a href="#default-outbound" id="default-outbound"></a>

During operation, Source to Stage Message Script variables will apply.

| Variable      | Type        | Description                                                                                                                                |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`         | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`       | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `message`     | GlideRecord | The record of the `Message` being used.                                                                                                    |
| `stage`       | GlideRecord | The record of the `Stage [x_snd_eb_stage]` being used. The actual table will differ between Processes.                                     |
| `$stage`      | Object      | The dynamic stage object.                                                                                                                  |
| `transaction` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                                                         |
| `bond`        | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                                                       |
| `source`      | GlideRecord | The record that is being integrated.                                                                                                       |
| `variables`   | Object      | Object used to contain Connection Variables.                                                                                               |

## Field Map <a href="#field-map" id="field-map"></a>

### All Mapping Scripts (Build phase only) <a href="#all-mapping-scripts-build-phase-only" id="all-mapping-scripts-build-phase-only"></a>

Only code contained within dollar-square brackets `$[...]` will be compiled. During operation, Message Script variables will apply.

| Variable    | Type        | Description                                                                                                                                |
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`       | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`.                                     |
| `error`     | String      | The error message to return from the script. Alternatively you can simply throw a `string` or `Error` and the system will take care of it. |
| `field`     | GlideRecord | The record of the `Field` being compiled.                                                                                                  |
| `$stage`    | Object      | The dynamic stage object.                                                                                                                  |
| `variables` | Object      | Object used to contain Connection Variables.                                                                                               |

## Response Action <a href="#response-action" id="response-action"></a>

| Variable           | Type        | Description                                                                                            |
| ------------------ | ----------- | ------------------------------------------------------------------------------------------------------ |
| `action`           | GlideRecord | The current `Response Action [x_snd_eb_response_action]` GlideRecord.                                  |
| `bond`             | Bond        | The record of the `Bond [x_snd_eb_bond]` being used.                                                   |
| `integration`      | GlideRecord | The record of the `Integration [x_snd_eb_integration]` being used.                                     |
| `message`          | GlideRecord | The record of the `Message` being used.                                                                |
| `request`          | GlideRecord | The record of the `HTTP Request [x_snd_eb_http_request]` being used.                                   |
| `response_payload` | Any         | A pre-processed payload string or object.                                                              |
| `transaction`      | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` being used.                                     |
| `log`              | Object      | Object containing several functions that can be used for logging. `info`, `warn`, `error` and `debug`. |
| `variables`        | Object      | Object used to contain Connection Variables.                                                           |

## Event Action <a href="#event-action" id="event-action"></a>

| Variable  | Type        | Description                                                                      |
| --------- | ----------- | -------------------------------------------------------------------------------- |
| `current` | GlideRecord | The record of the `Transaction [x_snd_eb_transaction]` that triggered the event. |
| `action`  | GlideRecord | The current `Event Action [x_snd_eb_event_action]` GlideRecord.                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sharelogic.com/unifi/2.2/scripting/variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
