Field variables are used throughout the system to insert values from a record in email templates, print templates, variable formula fields, and anywhere fields can be referenced in a formula. For example, you can use the $first_name variable in an email template so that the greeting can include the recipient's name.

The field variable corresponds to the field name and is set automatically when you create a custom field. The field name is automatically populated based on the field label, but you may also edit the name after it populates. Field names cannot include spaces and most special characters.

You can see a list of field variables in any table using any of these methods:

Field Variable Chains

Field variable chains allow you to reference fields from other tables. This can be useful when creating email and print templates. Field variable chains use the following syntax:

$fieldname1.fieldname2

The first field is a linked field in the current table that points to another record; the second field is the field in the linked table, also called the target table, whose value you want to use. Field variable chains can be as long as you like. If the second field links to another table, you could insert a third field variable to create a longer chain, a fourth field variable after that, and so on.

When creating field variable chains, each link in the chain must identify a unique record. For simplicity, we recommend using an ID field for each intermediate link. The exception is the last field in the variable chain, which is not restricted. The final field in the target table can be a related table, choice field, or other data type.

Use Case: Linking to a Contract Type from a Support Case

Suppose you have a knowledgebase with the following structure: 

Imagine you're creating a print template and want to show the type of contract for the submitter’s company in the support case. Suppose the only linked field in the Support Cases table is the Submitter ID. By using a chain of linked fields, you can pull in any information linked to that submitter, such as information from the Company record, the company’s linked Contract record, and so on.

Beginning the Variable Chain

To start building a variable chain, first take the field variable of the linked field in the current table. In this example, it's $submitter_id in the Support Cases table.

Next, use that variable in the following syntax: $submitter_id.field_name. This pulls in any field from the submitter’s user record. In this case, it's the specific record in the People table linked to the support case by the submitter's ID. You might need to check the Fields tab of the Table wizard in the target table, which in this example is the People table, to get the correct field variables.

If you were ending the variable chain here, you could pull in a value from the submitter's user record. Consider these examples:

Linking to the Companies Table

Instead of a value from the user's record, you want the value of the Contract Type field from the Companies table. To get to that field, you can look in the People table and see that the Company ID field links to the Companies table. Now you can build a chain that begins $submitter_id.company_id. This can pull in any field from the Company record, such as the Contract Type field:

In your print template that's run from the Support Cases table, the variable chain populates with the value from the Contract Type field.

Related articles