> For the complete documentation index, see [llms.txt](https://support.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.docstudio.com/user/scenarios/condition-types/attachment-reuse.md).

# ​Attachment Reuse

This document explains how to reuse attachments between scenario steps by copying attachment UUIDs from the source envelope to the target envelope.

You can re-use attachments uploaded in a previous scenario step. To do this, get the attachment UUID from the source envelope and set it for the respective attachment in the target envelope.

You can’t use the same attachment UUID more than once in the same envelope. Attachment re-use works only for envelopes created via scenarios.

**Source envelope**

Example source envelope:

{% code title="source-envelope.xml" lineNumbers="true" %}

```xml
<envelope templateUuid="bd6c94c9-715f-4611-bcb0-cc4114cff83d" templateVersion="bd6c94c9-715f-4611-bcb0-cc4114cff83d">
        <info>
                <subject>envelope subject</subject>
                <message/>
                <forwarding delegation="true" sharing="true"/>
        </info>
        <flow>
                <roles>
                        <role id="e1bcbffa-aed6-4022-baef-40dee2da8cef" mailboxUuid="8dcde243-a918-444a-ac7d-44ac88554769"/>
                        <role id="bc749581-1685-4650-8e91-f2c7187d7223" mailboxUuid="8dcde243-a918-444a-ac7d-44ac88554769"/>
                </roles>
        </flow>
    <documents>
                <document id="aa620e04-852b-4ae4-85d4-833f5fdfc79f">
                        <field name="File 1" attachmentUuid="5c03bf5e-b2f3-44bb-b313-eb432830189d">zipFileName.zip</field>
                </document>
                <document id="fc246044-bfa5-4224-8329-7656280ac45c">
                        <field name="b70d61fa-4805-4e7b-9561-aa1f4f5c653f" attachmentUuid="e3760a4e-4c7b-4323-aa7b-60a4351ba8ef">pdfFileName.pdf</field>
                </document>
        </documents>
</envelope>
```

{% endcode %}

To re-use attachments from the source envelope, use one of these patterns:

{% code title="attachment-reuse-select.xslt" lineNumbers="true" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        ...
        <field name="File 1">
            <xsl:attribute name="attachmentUuid" select="envelope/documents/document/field[@name='b70d61fa-4805-4e7b-9561-aa1f4f5c653f']/@attachmentUuid"/>
        </field>
        ...
    </xsl:template>
</xsl:stylesheet>
```

{% endcode %}

Or:

{% code title="attachment-reuse-variable.xslt" lineNumbers="true" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        ...
                    <xsl:variable name="att1Uuid" select="envelope/documents/document/field[@name='b70d61fa-4805-4e7b-9561-aa1f4f5c653f']/@attachmentUuid"/>
        <field name="File 1" attachmentUuid="{$att1Uuid}"></field>
        ...
    </xsl:template>
</xsl:stylesheet>
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.docstudio.com/user/scenarios/condition-types/attachment-reuse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
