# Template Variables

### List of Variables

Included below are a list of common variables you may want to use. When these are included in a Smart Link URL, they will be populated with dynamic data specific to the ticket that your agent is viewing.

If you want to reference fields not listed here, [let us know via this form](https://forms.gle/1UEJk4czC7ZzuChe7) and we're happy to help!&#x20;

<table><thead><tr><th width="252.99609375">Field</th><th width="309.92578125">Template String</th><th width="295.96875">Description</th></tr></thead><tbody><tr><td>Ticket ID</td><td><code>{{ticket.id}}</code></td><td>ID of the active ticket</td></tr><tr><td>Current User ID</td><td><code>{{currentUser.id}}</code></td><td>ID of the current user (agent)</td></tr><tr><td>Current User Email</td><td><code>{{currentUser.email}}</code></td><td>Email address of the current user (agent)</td></tr><tr><td>Requester ID</td><td><code>{{ticket.requester.id}}</code></td><td>ID of the ticket requester (end-user)</td></tr><tr><td>Requester External ID</td><td><code>{{ticket.requester.externalId}}</code></td><td>Externally-mapped ID of the ticket requester (end-user)</td></tr><tr><td>Requester Email</td><td><code>{{ticket.requester.email}}</code></td><td>Email address of the requester</td></tr><tr><td>Requester Phone Number</td><td><code>{{ticket.requester.$phone}}</code></td><td>The ticket requester's phone number contact in E.164 international format (<a href="https://developer.zendesk.com/api-reference/ticketing/users/users/#phone-number">docs</a>), eg. <code>+15551234567</code></td></tr><tr><td>Requester Phone Number (US-format)</td><td><code>{{ticket.requester.$phone-us}}</code></td><td>The ticket requester's phone number contact parsed for US format (removing country code), eg. <code>5551234567</code></td></tr><tr><td>Requester X / Twitter Handle</td><td><code>{{ticket.requester.$twitter}}</code></td><td>The ticket requester's X / Twitter contact handle</td></tr><tr><td>Requester Google Handle</td><td><code>{{ticket.requester.$google}}</code></td><td>The ticket requester's Google contact handle</td></tr><tr><td>Requester Facebook Handle</td><td><code>{{ticket.requester.$facebook}}</code></td><td>The ticket requester's Facebook contact handle</td></tr><tr><td>Custom Field</td><td><code>{{ticket.customField:custom_field_&#x3C;field_id>}}</code></td><td>Value of a custom field — replace <code>&#x3C;field_id></code> with the ID of the custom field, example: <code>{{ticket.customField:custom_field_12345678}}</code><br><br>See <a href="https://smart-apps.gitbook.io/smart-links/using-smart-links/template-variables#referencing-custom-fields">Referencing Custom Fields</a> for more details</td></tr><tr><td>Assignee ID</td><td><code>{{ticket.assignee.user.id}}</code></td><td>ID of the agent assigned to the active ticket</td></tr><tr><td>Assignee Email</td><td><code>{{ticket.assignee.user.email}}</code></td><td>Email address of the agent assigned to the active ticket</td></tr><tr><td>Brand ID</td><td><code>{{ticket.brand.id}}</code></td><td>ID of the brand associated with the ticket</td></tr><tr><td>Group ID</td><td><code>{{ticket.assignee.group.id}}</code></td><td>ID of the group assigned to the ticket</td></tr><tr><td>Form ID</td><td><code>{{ticket.form.id}}</code></td><td>ID of the ticket form used</td></tr></tbody></table>

Smart Links is built with a dynamic engine to allow you to access nearly any data accessible via the Zendesk agent workspace's Ticket Sidebar location via this "dot-notation" pattern. The above variables probably cover most use cases, but they are not all you can reference! See the [Zendesk API Reference](https://developer.zendesk.com/api-reference/apps/apps-support-api/ticket_sidebar/) for help creating your own, or reach out via our [Data Request](https://forms.gle/1UEJk4czC7ZzuChe7) form.

{% hint style="info" %}
***Why do some variables have a\*\*\*\* ****`$`**** ****in them, eg.**** ****`{{ticket.requester.$phone}}`****?***

These simply denote custom data fields that we provide via Smart Links that are not natively accessible through the Zendesk dot-notation method. Use these in the exact same way as other template variables, they are here to give you easy access to useful  data!
{% endhint %}

### Referencing Custom Fields

To reference the value of a custom field in a Smart Link, we will enter our template string in this syntax: `{{ticket.customField:custom_field_<field_id>}}`

To determine the `field_id` to use, you'll need to navigate to the **Zendesk Admin Center > Objects and rules > Tickets > Fields**

Here you can view and create new fields. To reference them via a Smart Link, copy the value of the `Field ID` column, and we'll use that in our smart link like so: `{{ticket.customField:custom_field_35588134477723}}`

<figure><img src="https://1468832480-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6NTV7Lak0QKd2q5ACzoz%2Fuploads%2F4jaTX024aOpuFfj8hYKs%2Fsmartlinks_customfield-id-view.png?alt=media&#x26;token=b701db9a-40fb-43d1-8e63-a84be15d9b40" alt=""><figcaption><p>Finding the Field ID of a custom field via the Zendesk Admin Console</p></figcaption></figure>


---

# 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://smart-apps.gitbook.io/smart-links/using-smart-links/template-variables.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.
