# CreateIncidentResponse Message

## New Message Modal

In **Unifi Integration Designer**, navigate to the **'Messages' icon**. Click **New**.

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

|  #  | Field        | Description                                                                                            | Value                    |
| :-: | ------------ | ------------------------------------------------------------------------------------------------------ | ------------------------ |
|  1  | Message name | The message name that is unique for this integration.                                                  | 'CreateIncidentResponse' |
|  2  | Type         | The primary purpose of the message.                                                                    | 'Response'               |
|  3  | Direction    | The direction(s) this message is configured to support.  *(Choices: Inbound, Outbound, Bidirectional)* | 'Inbound'                |

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

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmKHO6LZsc42Ah8B16%2F-MQmeQ9SPFrGN4Ui9vFI%2FV2%20-%20CreateIncidentResponse%201.png?alt=media\&token=e7ae1057-5795-4f34-b3b0-e3c1560aa75a)

4\) Click **Submit and view** to further configure the Message.

## Script Editor Fields

{% hint style="info" %}
The Scripts are where the request processing and data mapping occurs. They are also the place where Bond state & ownership are set.
{% endhint %}

5\) Navigate to **Advanced > Script Editor**.

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmKHO6LZsc42Ah8B16%2F-MQmeaZftv92Xtk0bkT_%2FV2%20-%20CreateIncidentResponse%202.png?alt=media\&token=e379105e-bb6e-426c-bccb-fdd27f0f65a8)

*When you first open the Script Editor, you will see the following:*

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmKHO6LZsc42Ah8B16%2F-MQmfAKUCpBwcbtV17v0%2FV2%20-%20CreateIncidentResponse%203.png?alt=media\&token=b5f785b9-d55b-47ac-b216-8d682088ae42)

{% hint style="success" %}
Having visibility of your message scripts in the one pane makes scripting so much more efficient.
{% endhint %}

Because we are dealing with an inbound message, we can adjust the view to only show the 'Payload to Stage' & 'Stage to Target' script fields.

6\) Navigate to **View > Inbound**.

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmKHO6LZsc42Ah8B16%2F-MQmfYma2ctqGDl9f85k%2FV2%20-%20CreateIncidentResponse%204.png?alt=media\&token=4c7fc94b-3a4d-4792-90ea-00d9492caed7)

*Your Script Editor fields will initially look like this:*

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmKHO6LZsc42Ah8B16%2F-MQmfkEQs14h18Gdef3Z%2FV2%20-%20CreateIncidentResponse%205.png?alt=media\&token=fe7a151a-8a5b-4eb9-ae57-218cd009d166)

## Scripts

{% hint style="info" %}
We will primarily by utilising OOTB Fields & Field Maps to configure our Message Scripts. In the current release, however, there is no OOTB Field Map record with which we can set the state on the Bond. We shall, therefore, script that manually. For more information , see the *'*[*Fields'*](https://docs.sharelogic.com/unifi/2.2/configuration/fields) & *'*[*Field Maps*](https://docs.sharelogic.com/unifi/2.2/configuration/field-maps)*'* pages in our technical documentation.
{% endhint %}

The Script Editor fields to be configured are as follows:

|  #  | Field                     | Description        | Value                                                                               |
| :-: | ------------------------- | ------------------ | ----------------------------------------------------------------------------------- |
|  7  | Stage to Target (Inbound) | The script to run. | Replace the commented out instructions with the following code: **bond.setOpen();** |

*The code in the 'Stage to Target' script field should look like this:*

```javascript
bond.setOpen();
```

{% hint style="info" %}
Setting the Bond state to Open allows messages to be sent/received.  See the '[Bonds](https://docs.sharelogic.com/unifi/2.2/bonding/bonds#state-control)' page for details.
{% endhint %}

*Your Script Editor fields should now look like this:*

![](https://796541950-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQBk35gIi557UHt7QlJ%2F-MQmgaddAbbZQNDQsJoT%2F-MQps-j67GXsWjh0VDRb%2FV2%20-%20CreateIncidentResponse%206.png?alt=media\&token=a3260c89-4a78-46ed-a979-bea56821d161)

8\) Click **Save**.

9\) Click **Close** to navigate back to the Message.

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