Page tree

Field Variables

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 Agiloft table using any of these methods:

  • Go to the table and select Print > Print All Fields.
  • When creating a new Word or PDF print template (Print > New Word/PDF Template), click Show Field Variables in the Print Template wizard.
    Show Field Variables button in print template wizard
  • Open the Formula Help wizard and go to the Fields tab. To insert field variables, click the variable name or label from this location. Field variables are inserted with the "$" prefix to designate them as a variable.
  • Navigate to the Fields tab of the Table wizard and find the Field name column. 
    Fields tab with Field name column highlighted

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: 

  • A record in the Support Cases table has a submitter, which is linked to a record in the People table.
  • The submitter’s user record in the People table is linked to a record in the Companies table.
  • The Company record in the Companies table is linked to a single Contract record in the Contracts table, and the Contract Type field is pulled into the Companies table as part of a linked set.

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:

  • $submitter_id.phone_number pulls in the submitter’s phone number.
  • $submitter_id.company_name pulls in the name of the submitter's company.

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:

  • $submitter_id.company_id.contract_type inserts the contract type for the contract that's linked to the company, which is linked to the submitter.

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