Table of Contents

Email Variables & Conditions

Jennifer Trower Updated by Jennifer Trower

Read Time: 4 mins

Using Variables in Sonar

Variables pull live data from your Sonar instance into a message, an agreement, or a canned reply. Sonar replaces the variable with the real value at the moment the item is generated, so one template can serve every account.

The variables available to you depend on where you are working, and inside a triggered message they depend on which trigger you select. An agreement template does not offer the same variables as a triggered message, and a mass message offers far fewer than either. Find your context below, then jump to the matching section.

For an explanation of when each trigger fires, see Trigger Explanations.

Where Variables Are Available

Triggered Message Variables

Context
What It Covers
Variables Available
Messages sent automatically when a system event occurs
The largest set. The list changes based on the trigger you select
Messages you write and send manually to one contact or many
The smallest set, and the same list for both
Pre-written replies your users insert into tickets
6 variables
Agreements and contracts sent to a contact for signature
11 variables

The Variables menu will not appear in the message body until the Trigger field is filled in. Once a trigger is selected, the menu appears and lists only the variables that trigger supports.

Most triggers offer the same account set, then add a small number of variables specific to the event. Two triggers are different: they cover Sonar users rather than accounts, and they offer the user set instead.

There is currently an issue where variable formatting may not be preserved when copying and pasting into the text editor, which can prevent the variables from working correctly.

See the section below for the available workaround and step-by-step instructions.
Known Issue: Variable Formatting When Pasting
Workaround: Variable formatting may not be preserved when you copy and paste into the text editor, which can stop the variables from working. Use the workaround below until this is resolved.

This workaround uses the { } button shown here.



Temporary Workaround:
1. Click the { } button within the text editor.



2. Paste the content that contains variables.



3. Click the { } button again.



For a full guide to the editor and its other controls, see Sonar's Rich Text Editor.

Account set

Available to 19 of the 23 triggers.

Variable
What It Displays
*|CONTACT_NAME|*
Contact name
*|ACCOUNT_NAME|*
Account name
*|CONTACT_ROLE|*
Contact role
*|CONTACT_EMAIL_ADDRESS|*
Contact email address
*|ACCOUNT_NUMBER|*
Account number
*|COMPANY_NAME|*
Company name
*|AMOUNT_DUE|*
Amount due
*|AMOUNT_DUE_RAW|*
Unformatted amount due
*|NEXT_BILL_DATE|*
Next bill date
*|AUTOPAY_ENABLED|*
Whether autopay is enabled on the account
*|AUTOPAY_RUNS_ENTIRE_AMOUNT_DUE|*
Whether autopay covers the entire amount due
*|INSTANCE_URL|*
Instance URL
*|CUSTOMER_PORTAL_URL|*
Customer portal URL

What each trigger adds

Trigger
Variables Beyond the Account Set
A contact's password is changed
None. Account set only
A credit card is expiring
*|LAST_4_DIGITS|*
A credit card or bank account payment is refunded
*|LAST_4_DIGITS|*, *|AMOUNT|*, *|REFUND_AMOUNT|*, *|PAYMENT_AMOUNT|*
A job is scheduled
*|JOB_TYPE|*, *|JOB_SCHEDULED_DATETIME|*
A late fee is applied to an account
*|LATE_FEE_AMOUNT|*, *|LATE_FEE_AMOUNT_RAW|*
A new user is created
Uses the user set instead of the account set, plus *|PASSWORD_CREATION_TOKEN|*
A payment failed
*|LAST_4_DIGITS|*, *|AMOUNT|*
A payment succeeded
*|LAST_4_DIGITS|*, *|AMOUNT|*
A primary service hits X% of their bandwidth cap
*|CURRENT_USAGE_CAP|*, *|USAGE_IN_GIGABYTES|*, *|SERVICE_NAME|*
A receipt for a payment
*|AMOUNT|*
A signed agreement is emailed to a contact
*|CUSTOM_MESSAGE|*
A user forgets their password and requests a new one
Uses the user set instead of the account set, plus *|PASSWORD_RESET_TOKEN|*
An account address is changed
None. Account set only
An account becomes delinquent
None. Account set only
An account is activated for the first time
None. Account set only
An agreement pending signature is emailed to a contact
*|CONTRACT_SIGNING_URL|*, *|CUSTOM_MESSAGE|*
An initial invoice is generated for a newly activated account
The full invoice set below
An invoice has been delinquent for X days
*|AMOUNT_DUE_ON_INVOICE|*, *|INVOICE_DUE_DATE|*
An invoice is due in X days
*|AMOUNT_DUE_ON_INVOICE|*, *|INVOICE_DUE_DATE|*
An invoice is manually emailed to a contact
The full invoice set below
An invoice is past due for X days
*|AMOUNT_DUE_ON_INVOICE|*, *|INVOICE_DUE_DATE|*
An invoice will become delinquent in X days
*|AMOUNT_DUE_ON_INVOICE|*, *|INVOICE_DUE_DATE|*
Billing runs successfully for an account
The full invoice set below

The invoice set

Added to the account set by the three invoice-generating triggers marked above.

Variable
What It Displays
*|INVOICE_NUMBER|*
Invoice number
*|INVOICE_DUE_DATE|*
Invoice due date
*|AMOUNT_DUE_ON_INVOICE|*
Amount due on this invoice
*|AMOUNT_DUE_ON_INVOICE_RAW|*
Unformatted amount due on this invoice
*|TOTAL_AMOUNT_DUE_PRIOR_INCLUDING_THIS_INVOICE|*
Total amount due prior to and including this invoice
*|TOTAL_AMOUNT_DUE_PRIOR_INCLUDING_THIS_INVOICE_RAW|*
Unformatted total amount due prior to and including this invoice
*|AUTO_PAY_DATE|*
Autopay date

The user set

USER_XXX variables refer to a user in your Sonar instance found under Settings > Security > Users. In other words, an employee user rather than a customer. Only the two user triggers offer these, and those triggers do not offer any account or billing variables.

Variable
What It Displays
*|USER_REAL_NAME|*
User real name
*|USER_USERNAME|*
User username
*|USER_EMAIL_ADDRESS|*
User email address
*|USER_MOBILE_NUMBER|*
User mobile phone number
*|USER_LANGUAGE|*
User language
*|USER_IS_SUPER_ADMIN|*
Whether the user is a super admin
*|USER_ROLE_ID|*
User role ID
*|INSTANCE_URL|*
Instance URL
*|CUSTOMER_PORTAL_URL|*
Customer portal URL

Saved Message and Mass Message Variables

Saved Messages and Mass Messages share one small variable set. Because these messages are written by hand rather than fired by an event, Sonar has no invoice, job, or payment record to draw from, so only account and contact level data is available.

Variable
What It Displays
*|ACCOUNT_NAME|*
Account name
*|ACCOUNT_NUMBER|*
Account number
*|AMOUNT_DUE|*
Amount due on any unpaid invoices
*|COMPANY_NAME|*
Company name
*|CONTACT_NAME|*
Contact name
*|FNAME|*
First name
*|LNAME|*
Last name
*|AUTOPAY_ENABLED|*
Whether autopay is enabled on the account

Canned Reply Variables

Variable
What It Displays
*|ACCOUNT_NAME|*
Account name
*|ACCOUNT_NUMBER|*
Account number
*|AMOUNT_DUE|*
Amount due
*|PHYSICAL_ADDRESS|*
Physical address
*|USAGE_IN_GIGABYTES|*
Usage in gigabytes
*|USAGE_CAP_IN_GIGABYTES|*
Usage cap in gigabytes

Agreement Template Variables

Variable
What It Displays
*|ACCOUNT_ADDRESS|*
Account address
*|ACCOUNT_NAME|*
Account name
*|ACCOUNT_NUMBER|*
Account number
*|CONTACT_NAME|*
Contact name
*|FNAME|*
First name
*|LNAME|*
Last name
*|DATE|*
Date
*|RECURRING_SERVICE_LIST|*
Recurring service list
*|RECURRING_SERVICE_LIST_WITH_PRICES|*
Recurring service list with prices
*|EXPIRING_SERVICE_LIST|*
Expiring service list
*|EXPIRING_SERVICE_LIST_WITH_PRICES|*
Expiring service list with prices

How did we do?

Communications: Messages Overview

Message Categories: Overview & Use Cases

Contact