# Test AddAttachment

{% hint style="success" %}
If necessary, create at least one bonded record in order to test the AddAttachment Message.
{% endhint %}

## Update Bonded Record (Originating Instance)

In the originating instance, **select one** **bonded ticket** and **Add** an **attachment** to the record .

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/z12yKNy557qjC8gUxehO/HTHAG%20-%20Test%20AddAttachment%201.png)

## Review Outbound Transport Data

From the bonded record, navigate to the **Unifi Integrations related list** and click to **open** the **Bond**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/elaVOq93yP7HomYBwxCk/HTHAG%20-%20Test%20AddAttachment%202.png)

{% hint style="success" %}
The External reference is populated. The State is "Open" and the Status is "OK".
{% endhint %}

From the Bond, navigate to the following related lists:

Navigate to the **Bonded Attachments related list** and verify that a **Bonded Attachment** record has been **created**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/kJSFUWqyrfmSF25AaPwY/HTHAG%20-%20Test%20AddAttachment%203.png)

{% hint style="success" %}
The State is "Complete".
{% endhint %}

Navigate to the **Transactions related list** and click to **open** the **AddAttachment Transaction**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/qUSPgGZ1LGTWpfbtDkNS/HTHAG%20-%20Test%20AddAttachment%204.png)

{% hint style="success" %}
The Transaction state is "Complete" and the Process state is "Accepted".
{% endhint %}

From the Transaction, navigate to the **HTTP Requests related list** and click to **open** the **HTTP Request**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/E71SrIg8PqzGSVC4I7MN/HTHAG%20-%20Test%20AddAttachment%205.png)

{% hint style="success" %}
The Request state is "OK".
{% endhint %}

Note the following about the HTTP Request:

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/NmPxZlehN5q75Y1klKPw/HTHAG%20-%20Test%20AddAttachment%206.png)

{% hint style="success" %}
**Endpoint URL**: A concatenation of the Connection URL appended with the [Path](https://github.com/sharelogic/unifi-docs/blob/dev/how-to-guides/how-to-handle-attachments/broken-reference/README.md) defined on the Message.

**Request headers**\*: Contains the mime\_type.

**Request payload**\*: The payload contains the "sys\_attachment:\<sysid>" (the format which Unifi expects & automatically triggers outbound streaming).

\*These objects were defined in the [Stage to Request script](https://github.com/sharelogic/unifi-docs/blob/dev/how-to-guides/how-to-handle-attachments/broken-reference/README.md).
{% endhint %}

{% hint style="info" %}
You will never see the attachment data in the payload itself.
{% endhint %}

## View Bonded Record (Receiving Instance)

In the receiving instance, navigate to the **corresponding** **bonded ticket** and verify the **attachment** has been **added** to the record.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/pzZIjkobQ3EcRy7WHoO0/HTHAG%20-%20Test%20AddAttachment%207.png)

{% hint style="success" %}
The attachment has been added to the bonded record.
{% endhint %}

## Review Inbound Transport Data

From the bonded record, navigate to the **Unifi Integrations related list** and click to **open** the **Bond**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/3ak5PZr5mUA2bVFwYCtu/HTHAG%20-%20Test%20AddAttachment%208.png)

{% hint style="success" %}
The External reference is populated *(note: the Internal/External reference values are opposite to the originating bond)*. The State is "Open" and the Status is "OK".
{% endhint %}

From the Bond, navigate to the following related lists:

Navigate to the **Bonded Attachments related list** and verify that a **Bonded Attachment** record has been **created**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/vOXsjdDufQoJLvll7ics/HTHAG%20-%20Test%20AddAttachment%209.png)

{% hint style="success" %}
The State is "Complete".
{% endhint %}

Navigate to the **Transactions related list** and click to **open** the **AddAttachment Transaction**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/yfNwQ0CkO6zzSxsG4Q66/HTHAG%20-%20Test%20AddAttachment%2010.png)

{% hint style="success" %}
The Transaction state is "Complete" and the Process state is "Accepted".
{% endhint %}

From the Transaction, navigate to the **HTTP Requests related list** and click to **open** the **HTTP Request**.

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/hXOymojAp651JND2vdOk/HTHAG%20-%20Test%20AddAttachment%2011.png)

{% hint style="success" %}
The Request state is "OK".
{% endhint %}

Note the following about the HTTP Request:

![](https://content.gitbook.com/content/77WwgPxoLSydiu2bJgNO/blobs/X55zj33nDHYP4bQMkStn/HTHAG%20-%20Test%20AddAttachment%2012.png)

{% hint style="success" %}
**Endpoint URL**: This is defined on the Resource path of the automatically generated Scripted REST Resource.

**Request payload**: The payload structure is defined in the [Scripted REST Resource script](https://github.com/sharelogic/unifi-docs/blob/dev/how-to-guides/how-to-handle-attachments/broken-reference/README.md).
{% endhint %}

**Congratulations!** You have successfully configured & tested a dedicated Message to stream inbound and outbound attachments.
