> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use dynamic variables

> Insert dynamic variables into contract models and email templates to populate customer, quote, and product data automatically.

{/* AUDIT NOTE: Variable syntax ({{variable.name}}) and date/number/conditional formatting are consistent with what was observed in the contract model editor. Nav path to contract model editor now confirmed: Content → Contract Models → [model name]. Whether typing {{ opens an autocomplete picker unverified. Email template location and variable reference panel button label remain as TODOs. Custom field variable syntax unverified. */}

Dynamic variables let you insert placeholders into contract models, email templates, and documents that automatically populate with real data when you generate or send them. You can reference customer details, quote totals, product names, and custom fields.

## Syntax

Dynamic variables use double curly braces: `{{variable.name}}`. They pull data from the customer record, quote, or line items associated with the document.

Common variable categories:

* `{{customer.*}}` — Customer information (name, email, address, custom fields)
* `{{quote.*}}` — Quote details (number, total, subtotal, status, dates)
* `{{product.*}}` — Product line item details (name, quantity, price, discount)
* `{{user.*}}` — Sales rep or owner information (name, email, title, phone)
* `{{company.*}}` — Your company details (name, address, logo URL)

<Note>
  Variable names are case-sensitive. Use the exact format shown in the variable reference panel.
</Note>

## Insert a variable into a contract model

<Steps>
  <Step title="Open the contract model editor">
    In the left side menu, click **Content** → **Contract Models**, then select the contract model you want to edit, or create a new one.
  </Step>

  <Step title="Position your cursor">
    Click where you want the variable to appear in the document body.
  </Step>

  <Step title="Insert the variable">
    Type `{{` to open the variable picker, or manually type the full variable name like `{{customer.name}}`. {/* TODO: verify if autocomplete picker exists */}

    Select the variable from the list or press **Enter** to confirm.
  </Step>

  <Step title="Preview the output">
    Click **\[BUTTON LABEL]** to see how the variable renders with sample data. {/* TODO: verify preview button label */}
  </Step>

  <Step title="Save the contract model">
    Click **Save** to apply your changes.
  </Step>
</Steps>

## Format variables

You can apply formatting modifiers to control how variables display.

### Date formatting

Add a format modifier after the variable name:

* `{{quote.created_date | date: "MM/DD/YYYY"}}` → 12/31/2024
* `{{quote.expiry_date | date: "MMMM D, YYYY"}}` → December 31, 2024

### Number formatting

Format currency and decimal values:

* `{{quote.total | currency}}` → \$10,000.00
* `{{product.quantity | number: 2}}` → 1,234.56

### Conditional logic

Show or hide content based on variable values:

```
{{#if quote.discount}}
A discount of {{quote.discount}}% has been applied.
{{/if}}
```

<Info>
  Advanced conditional logic and loops require specific syntax. Contact support for custom formatting requirements.
</Info>

## Use variables in email templates

You can insert dynamic variables into email subject lines and body text when configuring automated notifications or quote emails. {/* TODO: verify email template location */}

Navigate to **\[MENU PATH]** and select the email template. Use the same `{{variable.name}}` syntax in the subject or body fields.

## Common variables reference

| Variable                 | Description            | Example output                              |
| ------------------------ | ---------------------- | ------------------------------------------- |
| `{{customer.name}}`      | Customer full name     | Acme Corporation                            |
| `{{customer.email}}`     | Customer email address | [contact@acme.com](mailto:contact@acme.com) |
| `{{quote.number}}`       | Quote reference number | Q-2024-00123                                |
| `{{quote.total}}`        | Quote total amount     | 10000.00                                    |
| `{{quote.created_date}}` | Quote creation date    | 2024-01-15                                  |
| `{{user.name}}`          | Sales rep full name    | John Smith                                  |
| `{{user.email}}`         | Sales rep email        | [john@company.com](mailto:john@company.com) |
| `{{company.name}}`       | Your company name      | Your Company Inc.                           |

<Tip>
  To see the complete list of available variables for your instance, click **\[BUTTON LABEL]** in the contract model editor. {/* TODO: verify variable reference panel access */}
</Tip>

## What happens next

When you publish a quote or generate a contract, Qwoty replaces all variables with actual data from the associated records. If a variable references a field with no value, it displays as blank unless you configure a fallback.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Variable displays as {{customer.name}} instead of the actual value">
    The variable name may be misspelled or the field does not exist. Check the variable reference panel for the correct syntax. Verify the customer record contains data in that field.
  </Accordion>

  <Accordion title="Date displays in the wrong format">
    Add a date format modifier: `{{quote.created_date | date: "MM/DD/YYYY"}}`. Verify the format string matches the supported date tokens.
  </Accordion>

  <Accordion title="Variable shows blank in the generated document">
    The referenced field is empty in the source record. Add a default value using conditional syntax or populate the field before generating the document.
  </Accordion>

  <Accordion title="Custom field variables don't work">
    Custom field variables may use a different syntax like `{{custom.field_name}}` or `{{customer.custom_field_name}}`. Check with your admin or the variable reference panel for custom field naming conventions. {/* TODO: verify custom field variable syntax */}
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Create a contract model" icon="file-contract" href="/user-guide/documents/how-tos/create-contract-model">
    Build contract templates with variables and formatting
  </Card>

  <Card title="Configure email templates" icon="envelope" href="/user-guide/settings/introduction">
    Set up automated emails with dynamic content
  </Card>

  <Card title="Custom fields" icon="table-columns" href="/user-guide/settings/users/manage-users">
    Add custom fields to quotes and customers
  </Card>

  <Card title="Generate contracts" icon="file-export" href="/user-guide/quotes/reference/lifecycle">
    Create final contracts from approved quotes
  </Card>
</CardGroup>
