> For the complete documentation index, see [llms.txt](https://docs.upsmith.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.upsmith.app/atlassian-cloud/salesforce-for-confluence/user-guide/template-variables.md).

# Template Variables

Template Variables is the core functionality of the add-on. This is what sets our add-on apart from the others.

Template Variables enables the creation of customizable templates. You can use it to insert dynamic values into the query. Users simply fill in the gaps, making complex queries straightforward.

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

In the image above, a Query Template is defined to find Opportunities based on the matching AccountId. Notice the template variable **{{Account}}**.

You can use the defined template in SOQL List Macro.

Users utilizing this template simply need to input Account value.

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

<figure><img src="/files/kbdOgTEAviDBZ9OsXRVT" alt="" width="563"><figcaption></figcaption></figure>

Template Variables allow the same Query Template to be reused across different situations.&#x20;

<figure><img src="/files/vDBAbQ3bm19mYYrTz52o" alt="" width="563"><figcaption><p>Account Opportunities Template used for Account #1</p></figcaption></figure>

<figure><img src="/files/YKFv2iDe8VR6UxqPb7iz" alt="" width="563"><figcaption><p>Account Opportunities Template used for Account #2</p></figcaption></figure>

### Syncing Template Variable value across multiple macros

Beyond this, Template Variables enables integration between Salesforce Object and Salesforce List macros, making data handling more flexible and efficient.

In the example below, two Salesforce List macros are added on the same Confluence page.

Both of them require the value of **Account** to be filled. When **Account** value is updated on one macro, the value of the same variable will be updated on the other macro as well.&#x20;

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

<figure><img src="/files/14JFw5a5oNgvCGeogBKP" alt=""><figcaption></figcaption></figure>

In addition, you can link both macros to a Salesforce Object macro.

Select the option to **use Object ID as a template variable** when defining Salesforce Object Macro. Enter **Account** for variable name.

{% hint style="info" %}
To link variable in Salesforce List and Salesforce Object macro, the variable must have the **same** name
{% endhint %}

<figure><img src="/files/8zuuHWO3V3SU4MPRNtTH" alt=""><figcaption></figcaption></figure>

The AccountId values needed for the two lists will be automatically filled using the value from Salesforce Object Macro.

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

Template Variables allows you to tailor complex Salesforce process to reusable template.

The possibilities are endless!


---

# 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.upsmith.app/atlassian-cloud/salesforce-for-confluence/user-guide/template-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.
