# How to Create a Conversion Rule (Incoming Documents)

<figure><img src="/files/vgZgn7uBqXJrQbfdwBOT" alt=""><figcaption></figcaption></figure>

### Create an incoming conversion rule

1. Enter a rule name or keep the default name.
2. Turn on/off the rule.
3. Enable the incoming conversion rule option.
4. Configure the converted file naming pattern.
5. Enter the template UUID that matches the outgoing document.
6. Select the template version.

   * The system auto-fills the latest template version by default.
   * Select another version from the list if needed.

   When the template UUID and version are filled, the system auto-generates the conversion rule and the template.
7. Upload a source example file from your local machine.
   * The file content appears in the source file preview.
   * To update the content, update the local file and upload it again.
8. Review the generated conversion rule.

   * Click the info icon to see an example.
   * Update the conversion rule if needed.

   Review the auto-generated template.
9. Click the **Run Conversation** <img src="/files/qjZr81hFulId2RXBhRPO" alt="" data-size="line"> button to check the conversion result.
10. Review the result in **Result** window.
11. After successful execution, click the <img src="/files/ACG5de7RE8J5HuWqUniH" alt="" data-size="line"> button to create the conversion rule.

### Configure the converted file naming pattern

Use a naming pattern to generate the converted document name. If a document with the same name already exists, the system appends the conversion time.

Use these variables:

* `{mailboxUuid}`. Mailbox UUID that uses the integration.
* `{envelopeUuid}`. Envelope UUID created on the platform.
* `{randomNumber}`. Random number.
* `{templateUuid}`. Template UUID used to create the envelope.
* `{date dateFormat}`. Envelope receive date in the format you need. Use `DDMMYYYY` or another supported format.
* `{"documentId":"fieldName"}`. Value from a field in the template version used in the integration rule.

Restrictions for `{"documentId":"fieldName"}`:

* Supported field types: text, number, currency, date, dictionary, lookup, formula, duplicate, autonumber.
* Do not use fields from dynamic tables in the naming pattern.

Naming pattern validation:

* Use empty values for variables that are not filled in.
* If the naming pattern contains only an optional field, or no required fields are filled in at the moment of file creation, use `filename_empty` instead of variables.

{% hint style="info" %}
See [WDExtensions](/admin-panel/conversion-rules/wdextensions-overview.md) for XSLT helper functions used in conversion rules.
{% endhint %}

### (Optional) Receive the envelope archive on your server

Use this option to send a ZIP archive to your server based on the selected protocol.

<figure><img src="https://ucarecdn.com/b72060e2-72ab-4cb5-889c-a88bf8797bdb/image.png" alt=""><figcaption></figcaption></figure>

1. Enter the template UUID you want to integrate with.
2. Enable the ZIP archive option.
3. Select the archive type to send when the envelope is **COMPLETED**.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.docstudio.com/admin-panel/conversion-rules/how-to-create-a-conversion-rule-incoming-documents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
