# 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FmM3Z7mJWcQp7LvZChc4o%2FHTHAG%20-%20Test%20AddAttachment%201.png?alt=media)

## Review Outbound Transport Data

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

![](https://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2Fu3Xyz36pFhAl0tUovIcK%2FHTHAG%20-%20Test%20AddAttachment%202.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FH68AQ7tMLYd8fFP4IWDq%2FHTHAG%20-%20Test%20AddAttachment%203.png?alt=media)

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

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

![](https://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FOLZqtb4pMq5Ek72GHriw%2FHTHAG%20-%20Test%20AddAttachment%204.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FOTaktf5CmcKHpie2y6Nn%2FHTHAG%20-%20Test%20AddAttachment%205.png?alt=media)

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

Note the following about the HTTP Request:

![](https://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FyBj8OOuOz0qyRUkl6XlY%2FHTHAG%20-%20Test%20AddAttachment%206.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FMODFDeADDjDzySEv6vgr%2FHTHAG%20-%20Test%20AddAttachment%207.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FpNFAa0wrwjqCLS5VcxMC%2FHTHAG%20-%20Test%20AddAttachment%208.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2F025ItoU7Vb0duI8ne1Pp%2FHTHAG%20-%20Test%20AddAttachment%209.png?alt=media)

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

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

![](https://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2F2GiGWlzQNZTYwX5llRX5%2FHTHAG%20-%20Test%20AddAttachment%2010.png?alt=media)

{% 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://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FdQqJADOwVng6Fpep6tJ6%2FHTHAG%20-%20Test%20AddAttachment%2011.png?alt=media)

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

Note the following about the HTTP Request:

![](https://2763208740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZR0dkdEH0Mm7amiIzsdG%2Fuploads%2FPlwJcBJDpoO1nhHGB9re%2FHTHAG%20-%20Test%20AddAttachment%2012.png?alt=media)

{% 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.
