> For the complete documentation index, see [llms.txt](https://university.gonexa.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university.gonexa.fr/doc/en/getting-started/build-template/configure-document-template-in-salesforce.md).

# Configure a document template in Salesforce

Click the "Document template" tab

## Basic creation of the new template

* Click the "Document template" tab
* Click "New": by default, you create a "Main" template
* Give the template a name: it will be shown to the user when several templates exist on the same Salesforce object

![Creating a new document template](https://content.gitbook.com/content/U1Chwyf7Cc7FN9BiEh0V/blobs/UrDMB0liKm7iT4nNoRT4/01-01-nouveau-doc.gif)

## Select the main object

**What is the main object?**

It is the Salesforce object from which you want to trigger the generation, and the base context used to create a document and retrieve the data to display in the template. It can be a standard object, a custom object or an object from another Salesforce application.

* Select the main object from the drop-down list of objects available in your org
* The tag label is automatically populated with the object's API name, but you can change it as needed

{% hint style="success" %}
**Example**

You can rename the label `Opportunité_Gonexa_2026__c` to `Opp` to make the tags inserted into the template easier to understand and shorter.
{% endhint %}

## Generated file naming settings

{% hint style="warning" %}
**Tip**

To get a more personalized filename such as "Quote-{Today's Date} {Quote No.} Account Name", create a formula field on the main object and set it as the suffix.
{% endhint %}

* Enter the prefix you want to give to the names of the generated documents. This is fixed text that forms the first part of the filename.
* Define the suffix: choose a field on the main object that will dynamically form the second part of the filename.

![Main object, prefix and suffix](https://content.gitbook.com/content/U1Chwyf7Cc7FN9BiEh0V/blobs/3Dowsqi37uGPAtzzi1QJ/02-02-nom-objet-prefixe-suffixe.gif)

## Choose the version policy

* Select the version policy you want to apply to this document template from the 3 options.

![Version policy, output format and generation type](https://content.gitbook.com/content/U1Chwyf7Cc7FN9BiEh0V/blobs/bUJh71gUUYkHgnw4CMcI/03-03-politique-sortie-type.gif)

**VERSION CONTROL POLICIES**

| Policy                | Description                                                                                                                                               |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **New file**          | Each new generation on the same record creates a new file. *Allows you to keep the entire history.*                                                       |
| **New version**       | Each new generation on the same record creates a new version of the same file. *Recommended if you want to keep traceability while having only one file.* |
| **Clear and replace** | Each new generation on the same record overwrites the previous file and replaces it. *Useful for optimizing storage and always keeping only one file.*    |

## Available output formats

* Select the available output formats to apply from the options.

**AVAILABLE FORMATS**

| Format                    | Description                                                                                                        |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Original format & PDF** | Lets users choose to generate their document in the original format, such as Word, PowerPoint or Excel, or in PDF. |
| **Original format only**  | Users can generate their document only in the original format, i.e. Word, PowerPoint, Excel or PDF.                |
| **PDF only**              | Users can generate the document only in PDF format, without being able to edit it. **\[Most popular]**             |

## Select the generation type

* Select the generation type to apply from the options.

**GENERATION TYPES**

| Type            | Description                                                                                                                                                                                                           |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Synchronous** | Generates the document immediately and redirects you to it once generated **\[Most popular]**                                                                                                                         |
| **Future**      | Generates the document asynchronously, which means the action runs in the background. With a future generation, you are not redirected to the document and you need to refresh the page to see it                     |
| **External**    | Generates very large and complex documents on Gonexa servers. In this case, you are not redirected to the document and you need to refresh the page after a few seconds to see it. **\[Requires a specific license]** |

* Save your choices. You can change them at any time later.

The basic settings have been defined. You can go straight on to building the template. However, if you want to add tags from child objects, create them first before moving on to the design and tag insertion phase.

## Create child objects \[OPTIONAL]

**What is a child object?**

Optional: adding one or more child objects lets you display a related list of the main object, such as opportunity products, products or an account's contacts, in a table.

* Go to the "Gonexa Assistant" component to create child objects
* Click "+ Child object"

![+ Child object button in the Gonexa Assistant](https://4198981723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTYUzkIngX1MnHE8kOJDR%2Fuploads%2FAxleyEArAFLqFQYXhNn6%2Fconstruction-modele-2.png?alt=media)

* Choose the relevant Salesforce object
* The label defaults to the object's API name, but you can change it for greater clarity in the template.
* Add a filter if you want to filter the child records to retrieve
* ![Creating a child object (1/2)](https://content.gitbook.com/content/U1Chwyf7Cc7FN9BiEh0V/blobs/2I6FsZkMyF6FNJHYi5iG/04-04-creation-objet-enfant-numero-1.gif)
* Add a sort if you want to sort the results in the child table
* Finish this part by clicking "Create"

To learn more about adding child objects, see the article [Manage tables](/doc/en/getting-started/manage-tables.md)

![Creating a child object (2/2)](https://content.gitbook.com/content/U1Chwyf7Cc7FN9BiEh0V/blobs/dX29HXksrHd4qo7xVH6Z/05-04-creation-objet-enfant-numero-2.gif)


---

# 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://university.gonexa.fr/doc/en/getting-started/build-template/configure-document-template-in-salesforce.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.
