> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/user-documentation/working-with-documents-and-reports/creating-a-mail-merge.md).

# Creating a Mail Merge

This lesson will show you how to create a mail merge in AgileCase.

{% stepper %}
{% step %}

### Access mail merges

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

To create a mail merge in AgileCase, first access mail merges under the "Reports" tab on the toolbar.
{% endstep %}

{% step %}

### Create new mail merge

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

On the mail merges page, click "New Mail Merge" to proceed and create the new mail merge. This page will also store your previously created mail merges so you can run them at any time.
{% endstep %}

{% step %}

### Fill in details

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

When you create a mail merge, you must first enter a brief description to function as a title.

After this, you must choose a report as a data source and a template for the document you want to generate. Once this is finished, click "Save Changes" to create the new mail merge.
{% endstep %}

{% step %}

### Run a mail merge

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

Once you have created a mail merge, click the value under the "Last Run" column in order to run it. If you have not run the mail merge before, this value will appear as "Never Run".
{% endstep %}

{% step %}

### Create mail merge

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

This will take you to the mail merge history page. Clicking "Create Mail Merge" will run the merge and generate the documents.
{% endstep %}

{% step %}

### Mail merge details

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

When you run a mail merge, you will be presented with a notification of the number of documents to be generated as well as a couple of options:

* The description option allows you to choose between single and multiple documents. The "Single Document" options will generate all of the results as a single document so it can be easily printed off. The "Multiple Document" function will generate each as a single document against the appropriate case.
* The data source option selects what the mail merge is stored against. "Contacts" will store the document in the contact page of each client, "Cases" will store them against the relevant case, and "File System" will store the documents as files in the system.
  {% endstep %}
  {% endstepper %}


---

# 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 dynamically by asking a question.

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

```
GET https://docs.agilecase.com/user-documentation/working-with-documents-and-reports/creating-a-mail-merge.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
