# 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2Fu5b4wrduBCNC7GOeGoEp%2FHTHAG%20-%20Test%20AddAttachment%201.png?alt=media\&token=6d4f7822-6129-4909-a30a-70389718d73d)

## Review Outbound Transport Data

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

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2F97I02VtWYHArbSEG6SaQ%2FHTHAG%20-%20Test%20AddAttachment%202.png?alt=media\&token=36b56ff4-12c1-4eb0-a96a-5d803ee6e34f)

{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FWY2y5MzErPLQZIKKmNY2%2FHTHAG%20-%20Test%20AddAttachment%203.png?alt=media\&token=6bd2d83c-1d8a-4e3a-8563-9f8c3bba3b10)

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

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

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FEY69GO1Ay4BWKMwbAmnb%2FHTHAG%20-%20Test%20AddAttachment%204.png?alt=media\&token=3a4d7861-e24f-4cce-b85f-59ebba515d12)

{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2Fd7bbfhK6238ihz7vvJxP%2FHTHAG%20-%20Test%20AddAttachment%205.png?alt=media\&token=3cc274ec-263c-4299-a5c1-904479f475f2)

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

Note the following about the HTTP Request:

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FRYS0UtZ9jVAnaY5fS1bJ%2FHTHAG%20-%20Test%20AddAttachment%206.png?alt=media\&token=0983f942-0e30-47d5-b7ec-ec5fbf9f98fa)

{% hint style="success" %}
**Endpoint URL**: A concatenation of the Connection URL appended with the [Path](https://docs.sharelogic.com/unifi/3.1/how-to-guides/how-to-handle-attachments/broken-reference) 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://docs.sharelogic.com/unifi/3.1/how-to-guides/how-to-handle-attachments/broken-reference).
{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FMAmDsWQFDS0vroWajKxc%2FHTHAG%20-%20Test%20AddAttachment%207.png?alt=media\&token=612256bc-2ea5-49a5-bad6-1cfab44a869b)

{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FuQ7UZU9kYWwgFPp8Xj0E%2FHTHAG%20-%20Test%20AddAttachment%208.png?alt=media\&token=75b1db50-471a-4e0b-b568-0d3ee166faec)

{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FmIY30Yt6wUq2wq1XHSXN%2FHTHAG%20-%20Test%20AddAttachment%209.png?alt=media\&token=32dc8c67-f1e9-481d-a322-6c53fcb30f2d)

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

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

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FO7oexkv2KFdPugPk1gm4%2FHTHAG%20-%20Test%20AddAttachment%2010.png?alt=media\&token=4c5c9a89-4b24-4a9d-82b0-fdced0b2cf0d)

{% 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://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FPcBEn2dzEti2EyoYh39i%2FHTHAG%20-%20Test%20AddAttachment%2011.png?alt=media\&token=d9a740ee-407d-488f-a9ec-54098da5efd2)

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

Note the following about the HTTP Request:

![](https://605238050-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQBk35gIi557UHt7QlJ-850646046%2Fuploads%2FYYKDoH0KzSH50WgA5S2k%2FHTHAG%20-%20Test%20AddAttachment%2012.png?alt=media\&token=7e9a3ee8-f045-4c38-97f7-920fb06ea8df)

{% 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://docs.sharelogic.com/unifi/3.1/how-to-guides/how-to-handle-attachments/broken-reference).
{% endhint %}

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