# CreateIncidentInbound Message

## New Message Modal

Click the **'Messages' icon**, then **New**.

The fields to be configured for the CreateIncidentInbound New Message modal are as follows:

<table><thead><tr><th width="180.39344262295083">Field</th><th width="291.3333333333333">Description</th><th>Value</th></tr></thead><tbody><tr><td>Message name</td><td>The message name that is unique for this integration.</td><td>'CreateIncidentInbound'</td></tr><tr><td>Type</td><td>The primary purpose of the message.</td><td>'Create'</td></tr><tr><td>Direction</td><td>The direction(s) this message is configured to support.</td><td>'Inbound'</td></tr><tr><td>Description</td><td>The description for this message and the requirement it is meeting.</td><td>&#x3C;Your description></td></tr></tbody></table>

*Your CreateIncidentInbound New Message modal should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MgebMa6ajod_IrLJ8A_%2F-MgeiZE5Y6KcDiCN_vf2%2FICPG%20-%20CreteIncidentInbound%201.png?alt=media\&token=32537205-74b3-4599-85ad-1b704074b523)

Click **Submit and view** to further configure the Message.

## Response Fields

Navigate to **Message > Response**.

The Response fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="231.4">Description</th><th width="258.3099415204679">Value</th></tr></thead><tbody><tr><td>Response</td><td>The immediate synchronous response to this message.</td><td>lookup: 'Response'</td></tr><tr><td>Async*</td><td>Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair.</td><td>&#x3C;true></td></tr><tr><td>Async receipt</td><td>The asynchronous receipt to this message. Leaving this blank will cause the message to be processed async without sending a receipt.</td><td>lookup: 'CreateIncidentInboundReceipt'</td></tr></tbody></table>

*\*This field is automatically defaulted to true.*

*Your Response form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MgebMa6ajod_IrLJ8A_%2F-Mgejd6OP5wsIFd6vSIj%2FICPG%20-%20CreteIncidentInbound%202.png?alt=media\&token=df745e7b-e729-4de1-9f26-1cee3b44c3c0)

Navigate to **Message > Bond**.

## Bond Fields

The Bond fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="365.0381295982747">Description</th><th>Value</th></tr></thead><tbody><tr><td>Bond ownership*</td><td>Determine if the sender should own the bond or not in order for this message to be processed? Use 'Ignore' to process regardless of the owner flag.  <em>(Choices: Ignore, Must own, Must not own.)</em></td><td>'Ignore'</td></tr><tr><td>Bond condition type*</td><td>The type of conditional check made on the bond. (<em>None:</em> no checks are made. <em>State:</em> checks against the state are made using the conditional checkboxes. <em>Scripted:</em> the 'Bond condition' script is used.)</td><td>'State'</td></tr><tr><td>Bond new</td><td>Process this message when a new bond is required.</td><td>&#x3C;true></td></tr><tr><td>Set bond state inbound*</td><td>Set the Bond State when receiving this message. Use 'None' to leave the Bond State alone or to modify it via a Message/Field Stage to Target script.</td><td>'Open'</td></tr></tbody></table>

*\*These fields are automatically populated.*

{% hint style="info" %}
\*Set bond state choices: *None, Pending, Open, Suspended, Vendor suspended, Closed*
{% endhint %}

*Your Bond form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MgebMa6ajod_IrLJ8A_%2F-Mgf4A2f4qtqbARmBsLJ%2FICPG%20-%20CreteIncidentInbound%203.png?alt=media\&token=4919cfba-d953-4b2c-bb57-6417f5d071c5)

Navigate to **Inbound > Settings**.

## Inbound Settings Fields

The Inbound Settings fields to be configured are as follows:

<table><thead><tr><th width="150">Field</th><th width="271.7804878048781">Description</th><th>Value</th></tr></thead><tbody><tr><td>Bond reference method*</td><td>Method of searching for and validating an existing bond for incoming messages.</td><td>'External'</td></tr><tr><td>Reference lookup script</td><td>The script containing functions for extracting internal and external references from the request payload.</td><td>Update the code in the Reference lookup script field so that it looks like the code below</td></tr></tbody></table>

{% hint style="info" %}
\*Bond reference method *(defaulted to 'External' & not editable for Create type Messages):*

*Internal -* lookup using the internal reference only.

*External -* lookup using the external reference only.

*Both -* lookup using both the internal and external references.
{% endhint %}

{% hint style="success" %}
**Bond reference method:** The perspective of the available choices is in relation to the receiving instance i.e. Internal (internal reference) means the bonded ticket in our instance and External (external reference) means the bonded ticket in their instance. These settings define which values to lookup against to search for and validate whether or not a bond already exists.

In the case of a create type message (as per our requirement), it is defaulted to 'External' because there is not yet a bonded ticket in the receiving instance to reference *(if we were to receive a create type message which referenced a bond that already existed it would be rejected because we don't want to create another bond for a record we've already seen )*.
{% endhint %}

*The code in the 'Reference lookup script' field should look like this:*

```javascript
var answer = {};

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

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

{% hint style="info" %}
**Reference lookup script:** It’s important to identify which message an asynchronous receipt is replying to. This script extracts the transaction’s unique identifier.

In the case of an inbound create/update (as per our requirement) it would return their external message id (source id) to identify which transaction our asynchronous receipt belongs to. *(In the case of an inbound asynchronous receipt it would return our internal message id (target id) to identify which transaction their asynchronous receipt belongs to.)*
{% endhint %}

*Your Inbound Settings form should look like this:*

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MgebMa6ajod_IrLJ8A_%2F-Mgf5qo1sD3WHCBZRKV-%2FICPG%20-%20CreteIncidentInbound%204.png?alt=media\&token=deb5c02d-6fec-4b8f-bbb9-64916571d353)

Click **Save**.

We are now ready to configure the **Fields** for our **CreateIncidentInbound** Message.
