# Variables

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

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

The Add Note Script is used to notify the end user about integration events. These notes are automatically added during processing and the script allows the target of the note to be customised. E.g., notes are usually added to work notes on Task-based tables, but a custom table might have a different field for this.

```javascript
// An example add note script
function addNote(target, note, options) {
  var message = '[' + options.integration_name + ' Integration] ' + note;
  if (options.type == 'error' || options.type == 'warn') {
    message = '[code]<span style="color: red">' + message + '</span>[/code]';
  }
  target.work_notes = message;
}
```

<table><thead><tr><th width="303.7030952445372">Variable</th><th width="150">Type</th><th width="249.85007136770193">Description</th></tr></thead><tbody><tr><td><code>target</code></td><td>GlideRecord</td><td>The target record to update, e.g. an Incident record.</td></tr><tr><td><code>note</code></td><td>String</td><td>The update message.</td></tr><tr><td><code>options</code></td><td>Object</td><td>An object containing specific properties depending on the note being added.</td></tr><tr><td><code>options.integration_name</code></td><td>String</td><td>The name of the integration.</td></tr><tr><td><code>[options.response_action]</code></td><td>GlideRecord</td><td><p>The <code>Response Action [x_snd_eb_response_action]</code> record being used.</p><p><em>Only provided with response action notification.</em></p></td></tr><tr><td><code>[options.type]</code></td><td>String</td><td><p>The type of note: <code>info</code> or <code>error</code>.</p><p><em>Only provided with Bond specific notes.</em></p></td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Identify Message Script is executed when an inbound request is received. It returns the name of the message that should be used to process the request. Typically, message names are embedded within the request payload, but it's possible to use the other variables available for more complex identification.

```javascript
// An example identify script
function identify() {
  return (payload.message.name || '') + '';
}
```

<table><thead><tr><th width="162.1039697542533">Variable</th><th width="150">Type</th><th width="363.12817872079677">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td><code>query</code></td><td>Object</td><td>A key-value pair object containing the request URL query parameters. </td></tr><tr><td><code>integration</code></td><td>GlideRecord</td><td>The <code>Integration [x_snd_eb_integration]</code> record.</td></tr><tr><td><code>connection</code></td><td>GlideRecord</td><td>The <code>Connection [x_snd_eb_connection]</code> record used to receive the request.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

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

The Endpoint URL will be prepended to Message Path values (providing they do not override). Inline scripts using curly braces `{}` can be used to construct more advanced endpoints.

{% hint style="info" %}
See [Message Path](#path) parameters for available variables.
{% endhint %}

{% hint style="warning" %}
We recommend dynamic endpoints only be considered for the same environment. New environments should have new connections so they can be managed more easily.
{% endhint %}

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

### Advanced condition

The Advanced condition is used to script complex trigger logic into the message. Only use this if you cannot use the Outbound condition filters and the single line Outbound condition.

{% hint style="info" %}
See [Outbound condition](#outbound-condition) parameters for available variables.
{% endhint %}

### Extract attachments script

<table><thead><tr><th width="222.004848017288">Variable</th><th width="150">Type</th><th width="308.5362448737123">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>String,Stream</td><td>The raw inbound payload object to process. Attachment data should be removed and replaced with the attachment sys_id in the format "&#x3C;x-attachment-data sys_id=></td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td><code>params</code></td><td>Object</td><td>A key-value pair object of URL parameters.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The record of the <code>HTTP Request [x_snd_eb_http_request]</code> being used.</td></tr><tr><td><code>options</code></td><td>Object</td><td>An object containing specific properties for processing.</td></tr><tr><td><code>options.is_stream</code></td><td>Boolean</td><td>True if the inbound payload is a stream.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Path is used to modify the endpoint for the message. It can be used with inline script evaluation to construct more advanced endpoints. Inline scripts should be wrapped with dollar curly braces `${...}`.

```javascript
/table/incident/${bond.getValue("external_reference")}
```

<table><thead><tr><th width="183.92724046140194">Variable</th><th width="150">Type</th><th width="376.2">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The <code>HTTP Request [x_snd_eb_http_request]</code> record.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The <code>Stage [x_snd_eb_stage]</code> record.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage which is automatically stored on the stage record.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The current <code>Transaction [x_snd_eb_transaction]</code> record.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>scratchpad</code></td><td>Object</td><td>An object that can be used to pass variables between scripts.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The outbound condition is an inline script field useful for simple one-line conditions to be used in conjunction with the filter.

{% hint style="info" %}
More advanced conditions can be made in the [Advanced condition](#advanced-condition) script field.
{% endhint %}

```javascript
current.assignment_group && String(current.assignment_group.u_unifi_integrations).indexOf(message.integration) != -1
```

<table><thead><tr><th width="181.0407252529832">Variable</th><th width="150">Type</th><th width="398.99445280053396">Description</th></tr></thead><tbody><tr><td><code>current</code></td><td>GlideRecord</td><td>The record that triggers the message. The actual table will differ between Processes.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Reference lookup script is used to extract the internal and external message ID's when an inbound request is received. These ID's are used to locate the bond (and therefore the target) the request applies to.

```javascript
// An example reference lookup script
var answer = {};

answer.getExternalMessageID = function (payload, request) {
  return '' + (payload.message.source_id || '');
};

answer.getInternalMessageID = function (payload, request) {
  return '' + (payload.message.target_id || '');
};
```

<table><thead><tr><th width="150">Variable</th><th width="150">Type</th><th width="373.2">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The record of the <code>HTTP Request [x_snd_eb_http_request]</code> being used.</td></tr><tr><td><code>answer</code></td><td>Any</td><td>The result of the script being called.</td></tr><tr><td><code>current</code></td><td>GlideRecord</td><td>The record that triggers the message. The actual table will differ between Processes.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The XML Template is evaluated in a similar way to a UI Macro and is extremely useful in constructing advanced XML based payloads using Jelly. Other types of payload can be constructed here, however it's normally easier to do this with the Fields and Field Maps or directly in the Message Scripts.

The XML Template will only be evaluated if the payload has not already been set within the Stage to Request message script.

{% hint style="info" %}
Install the [Unifi Global Utility](https://docs.sharelogic.com/unifi/install/installation#install-global-utility) for full support of Jelly within XML Templates.
{% endhint %}

```markup
<!-- An example XML template -->
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:evaluate jelly="true">
		var transaction = jelly.jvar_transaction;
		var stage = jelly.jvar_stage;
		var message = jelly.jvar_message;
	</g:evaluate>
	<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
		<soapenv:Header />
		<soapenv:Body>
			<MessageName>${HTML:message.message_name}</MessageName>
		</soapenv:Body>
	</soapenv:Envelope>
</j:jelly>	
```

<table><thead><tr><th width="172.96675018428922">Variable</th><th width="150">Type</th><th width="354.98116500499094">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The <code>HTTP Request [x_snd_eb_http_request]</code> record.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The <code>Stage [x_snd_eb_stage]</code> record.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage which is automatically stored on the stage record.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The current <code>Transaction [x_snd_eb_transaction]</code> record.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>scratchpad</code></td><td>Object</td><td>An object that can be used to pass variables between scripts.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

## 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>

The Source to Stage script is used to capture data from the source record, e.g., an Incident, and save it to the stage record where it is ready to be used to generate a payload.

{% hint style="info" %}
Source data values should be captured in full (including referenced values) in the Source to Stage script.
{% endhint %}

```javascript
// Example source to stage script (using dynamic stage)
$stage.short_description = '' + source.short_description;
```

<table><thead><tr><th width="182.25695476876558">Variable</th><th width="150">Type</th><th width="346.0672526862377">Description</th></tr></thead><tbody><tr><td><code>source</code></td><td>GlideRecord</td><td>The record that is being integrated.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The record of the <code>Stage [x_snd_eb_stage]</code> being used. The actual table will differ between Processes.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage object.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The record of the <code>Transaction [x_snd_eb_transaction]</code> being used.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Stage to Request script is used to generate a payload using the data captured on the stage.

{% hint style="info" %}
Payload generation and request configuration should be done in the Stage to Request script.
{% endhint %}

```javascript
// Example stage to request script (using dynamic stage)
payload.short_description = $stage.short_description;
```

<table><thead><tr><th width="183.8140402680208">Variable</th><th width="150">Type</th><th width="365.29508196721315">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td><code>query</code></td><td>Object</td><td>An object containing the request URL query parameters. This object is compiled and automatically added to the search query of the URL.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The <code>HTTP Request [x_snd_eb_http_request]</code> record.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The <code>Stage [x_snd_eb_stage]</code> record.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage which is automatically stored on the stage record.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The current <code>Transaction [x_snd_eb_transaction]</code> record.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>scratchpad</code></td><td>Object</td><td>An object that can be used to pass variables between scripts.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Payload to Stage script is used to capture data from the inbound request payload and save it to the stage record where it is ready to be used to update the target record.

```javascript
// Example payload to stage script (using dynamic stage)
$stage.short_description = payload.short_description;
```

{% hint style="info" %}
Data should be extracted from the inbound payload and headers in the Payload to Stage script.
{% endhint %}

<table><thead><tr><th width="162.78749202297385">Variable</th><th width="150">Type</th><th width="359.7387852223541">Description</th></tr></thead><tbody><tr><td><code>payload</code></td><td>Any</td><td>The payload string or object. Pre-processing can be configured on the Integration to automatically convert JSON to <code>Object</code> or XML to <code>XMLDocument2</code>.</td></tr><tr><td><code>headers</code></td><td>Object</td><td>An object containing request headers keyed by header name.</td></tr><tr><td><code>query</code></td><td>Object</td><td>A key-value pair object containing the request URL query parameters. </td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The <code>HTTP Request [x_snd_eb_http_request]</code> record.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The <code>Stage [x_snd_eb_stage]</code> record.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage which is automatically stored on the stage record.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The current <code>Transaction [x_snd_eb_transaction]</code> record.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

The Stage to Target script is used to update the target record, e.g., an Incident, with the data and references given in the stage.

{% hint style="info" %}
Reference lookups, data validation, and business logic should be done in the Stage to Target script.
{% endhint %}

```javascript
// Example stage to target script (using dynamic stage)
target.short_description = $stage.short_description;
```

<table><thead><tr><th width="150">Variable</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>target</code></td><td>GlideRecord</td><td>The record that is being integrated.</td></tr><tr><td><code>stage</code></td><td>GlideRecord</td><td>The record of the <code>Stage [x_snd_eb_stage]</code> being used. The actual table will differ between Processes.</td></tr><tr><td><code>$stage</code></td><td>Object</td><td>The dynamic stage object.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The record of the <code>Transaction [x_snd_eb_transaction]</code> being used.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr></tbody></table>

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

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

The default inbound script can be used so set the default value to be used by the Field Map when no value is found on the stage.

{% hint style="info" %}
See [Stage to Target (Inbound)](#stage-to-target-inbound) for available variables.
{% endhint %}

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

The default outbound script can be used so set the default value to be used by the Field Map when no value is found on the source.

{% hint style="info" %}
See [Source to Stage (Outbound)](#source-to-stage-outbound) for available variables.
{% endhint %}

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

Fields maps are compiled during Build operations with the field as an input and the resulting code is added to the respective Message Scripts.

Only code contained within dollar-square brackets `$[...]` will be compiled. During inbound/outbound processing, standard Message Script variables will apply.

{% tabs %}
{% tab title="Field Map" %}

```javascript
var is_mandatory = $[field.mandatory];

if (is_mandatory && $payload.$[field.property] == undefined) {
  throw 'Mandatory field $[field.property] was not provided';
} else {
  $stage.$[field.element] = $payload.$[field.property];
}
```

{% endtab %}

{% tab title="Message Script" %}

```javascript
var is_mandatory = false;
  
if (is_mandatory && $payload.short_description == undefined) {
  throw 'Mandatory field short_description was not provided';
} else {
  $stage.short_description = $payload.short_description;
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="197.49013578085822">Variable</th><th width="150">Type</th><th width="325.2469321782992">Description</th></tr></thead><tbody><tr><td><code>field</code></td><td>GlideRecord</td><td>The record of the <code>Field</code> being compiled.</td></tr><tr><td><code>default_value</code></td><td>Any</td><td>This is the value defined by the Field in its Default Inbound and Default Outbound scripts. It applies only to Source to Stage (Outbound) and Stage to Target (Inbound) scripts.</td></tr></tbody></table>

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

Response Actions allow you to automatically handle or perform tasks based on the response to an outbound request. All scripted fields within a Response Action have access to the same set of predefined variables.

<table><thead><tr><th width="222.3011067476536">Variable</th><th width="150">Type</th><th width="370.6470876444075">Description</th></tr></thead><tbody><tr><td><code>action</code></td><td>GlideRecord</td><td>The current <code>Response Action [x_snd_eb_response_action]</code> GlideRecord.</td></tr><tr><td><code>bond</code></td><td>Object</td><td>Instance of Unifi Bond class.</td></tr><tr><td><code>integration</code></td><td>GlideRecord</td><td>The record of the <code>Integration [x_snd_eb_integration]</code> being used.</td></tr><tr><td><code>message</code></td><td>GlideRecord</td><td>The record of the <code>Message</code> being used.</td></tr><tr><td><code>request</code></td><td>GlideRecord</td><td>The record of the <code>HTTP Request [x_snd_eb_http_request]</code> being used.</td></tr><tr><td>headers</td><td>Object</td><td>An object containing the request headers.</td></tr><tr><td>query</td><td>Object</td><td>An object containing the request query parameters.</td></tr><tr><td><code>response_code</code></td><td>String</td><td>The response <code>status_code</code>.</td></tr><tr><td><code>response_headers</code></td><td>Object</td><td>An object containing response headers.</td></tr><tr><td><code>response_payload</code></td><td>Any</td><td>A pre-processed payload string or object.</td></tr><tr><td><code>transaction</code></td><td>GlideRecord</td><td>The record of the <code>Transaction [x_snd_eb_transaction]</code> being used.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr></tbody></table>

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

<table><thead><tr><th width="150">Variable</th><th width="150">Type</th><th width="379.2">Description</th></tr></thead><tbody><tr><td><code>current</code></td><td>GlideRecord</td><td>The record of the <code>Transaction [x_snd_eb_transaction]</code> that triggered the event.</td></tr><tr><td><code>action</code></td><td>GlideRecord</td><td>The current <code>Event Action [x_snd_eb_event_action]</code> GlideRecord.</td></tr></tbody></table>

## Poll Processors

### Variables <a href="#pollprocessorvariables" id="pollprocessorvariables"></a>

Poll Processor scripts have the following variables available.

<table><thead><tr><th>Variable</th><th width="150">Type</th><th width="354">Description</th></tr></thead><tbody><tr><td><code>connection</code></td><td>Connection</td><td>An instance of the Connection object that is being used.</td></tr><tr><td><code>params</code></td><td>Object</td><td>An object that allows values to be passed between poll processor scripts.</td></tr><tr><td><code>poll_request</code></td><td>GlideRecord</td><td>The Poll Request <code>[x_snd_eb_poll_request]</code> record being used.</td></tr><tr><td><code>poller</code></td><td>Poller</td><td>An instance of the Poller object that is being used.</td></tr><tr><td><code>variables</code></td><td>Object</td><td>Object used to contain Connection Variables.</td></tr><tr><td><code>log</code>,<code>console</code></td><td>Object</td><td>Object containing several functions that can be used for logging. <code>info</code>, <code>warn</code>, <code>error</code> and <code>debug</code>.</td></tr><tr><td><code>error</code></td><td>String</td><td>The error message to return from the script. Alternatively you can simply throw a <code>string</code> or <code>Error</code> and the system will take care of it.</td></tr><tr><td><code>ignore</code></td><td>Boolean</td><td>Set <code>ignore=true</code> to prevent the poll processor from running.<br><mark style="color:orange;">*Setup Script only.</mark></td></tr><tr><td><code>answer</code></td><td>Any</td><td>It's possible to set the result of the request script to the <code>answer</code> variable instead of returning it in the function. This value is empty by default.<br><mark style="color:orange;">*Request Script only.</mark></td></tr><tr><td><code>response</code></td><td>Any</td><td>The response from the request script.<br><mark style="color:orange;">*Response Script only.</mark></td></tr></tbody></table>

### Data Store Values

Some useful data values can be fetched from the Poller data store.\
e.g. `poller.getData("$last_execution_time")`

<table><thead><tr><th width="266.3333333333333">Name</th><th width="150">Type</th><th width="276.7257977285019">Description</th></tr></thead><tbody><tr><td><code>$execute_counter</code></td><td>Integer</td><td>The number of times the poller has been executed.</td></tr><tr><td><code>$last_completed</code></td><td>Date Time</td><td>The last date/time the poller was executed successfully. Use with <code>poller.getlastCompleted()</code> to always get a valid date.</td></tr><tr><td><code>$last_execution_time</code></td><td>Date Time</td><td>The last date/time the poller was executed, whether successful or not.</td></tr></tbody></table>
