> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/enhanced-template-editor/merge-field-variables.md).

# Merge Field Variables

This article outlines how to simplify and automate processes by inserting standard, custom, and runtime, or special, merge field variables into your document templates. Adding these fields ensures your documents dynamically pull accurate data directly from your Salesforce records. You can insert fields using either the *Variables* panel or direct keyboard inputs.

#### Variables Panel Overview

The *Variables* panel provides a visual, searchable list of all available fields for your template.

**Access the panel**

To open the panel, click the **Variables** icon ![](/files/xWPAmanZr12xdJpqqHAj) located in the left-hand drawer menu to the left of the document editing interface.

{% hint style="info" %}
The panel automatically displays fields based on the base record type assigned to your template. For example, if you are building a template for an Opportunity Record, the editor will automatically populate relevant opportunity fields from your organization.
{% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/nU0nPSAug3nBimkNSHJu" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}
**Panel features and navigation**

* **Search field:** quickly find a specific field by searching for its label name in the *Search* bar at the top of the panel.
* **Data type filtering:** click the icons to sort and view fields by specific data types, including text ![](/files/BxXe0pT3yjrzF8gUj5Xp), numbers ![](/files/X3QZAUaHiB01GOXIfwQJ), booleans (checkbox) ![](/files/IQ4TmrX7KN9oQl2frKnA), and dates ![](/files/c79yMKJuowrxZKMskiJr).
* **Record type variables:** All Standard and Custom fields configured for the record type in the Salesforce org.
* **Lookup variables:** Indicated by a right-facing arrow ![](/files/7X22mYVjWOlxez5u1mw6). Clicking these allows you to drill down up to five layers deep into applicable lookup records.
* **Runtime variables:** Special system information fields that populate at runtime/generation.
* **\*Advanced Data Configurations** ![](/files/C34uUmNHB5Vdq5jcfwES)**:** Add in-depth data source options such as SOQL, Apex, User Inputs, and Component templates to the Variables menu.
  {% endcolumn %}
  {% endcolumns %}

#### Insert Fields from the Variables Panel

1. Place your cursor at the exact position in the template where you want to insert the field.
2. Click the desired field tile within the *Variables* list. The merge field will instantly appear at your cursor location.

#### Insert Fields from the @ Keyboard Command

For a faster workflow, you can insert merge fields directly from your keyboard without using your mouse.

1. Within the document editor, type **"@" (Shift + 2)** where you want to place the field. This action activates an inline dropdown menu.
2. The dropdown menu mirrors the fields and data available in the *Variables* panel.
3. Use your keyboard arrow keys or the search feature to navigate through the list.
4. Press the Enter key to insert the selected field directly at your cursor position.

#### Optional Advanced Data

For advanced technical use cases, you can utilize external or programmatic data sources within your template:

* **Components:** Configured [component templates](/sdocs/enhanced-template-editor/supported-file-formats-for-enhanced-templates.md) for the parent record type.
* **User Inputs:** Create user input variables that allow generating users the ability to provide real-time data inputs at run-time.
* **SOQL queries:** Determine data sources across one-to-one or one-to-many relationships.
* **Apex:** Call custom data into your template using a callable Apex architecture.

{% hint style="info" %}
**Advanced Data** sources are optional and only appear in the variables panel when configured.
{% endhint %}


---

# 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://help.sdocs.com/sdocs/enhanced-template-editor/merge-field-variables.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.
