Template references support object, field, and expression references. They can be used throughout your Workflow to customize Webforms, PDFs, and settings.
In this article, we’ll specifically go over object and field references. For more information about expression references, please see our Advanced JSON Editor guide.
Getting started
Template references help you pass existing and/or dynamic information to different sections of your Workflow.
They can be paired with explanation text type fields to personalize your Webform, connected to PDF fields with the advanced JSON editor, or used directly in your Workflow settings.
Here are some scenarios where you might want to utilize references within your Workflow:
- Displaying information your customer cannot edit in the Webform
- Creating custom instructions for different parties, including a specific customer’s title and name
- Providing dynamically calculated cost information in your Webform for your customer to review
- Output a dynamically calculated value in a PDF field
- Including your customers' company name within a signature request email
Object references
Objects refer to things like your Organization, a Workflow (weld), a Webform (forge), etc), a Webform submission (submission), and a Workflow submission (weldData).
You can reference different parts of each object depending on what information you want displayed in your Webform.
Objects
In the context of what can be referenced in a Workflow:
- Organization: Synonymous with your companys' account in the Anvil app.
- Workflow (weld): The Workflow that you are actively working with.
- Webform (forge): The Webform(s) included in the Workflow you’re working with.
- Since Workflows can include multiple Webforms, this refers to the Webform you’re actively adding references to.
- You cannot reference other Webforms within the Workflow.
- Webform submission (submission): The result of a completed Webform.
- Each Webform within a Workflow has its own submission
- Referenced information will be specific to the particular Webform submission you’re working with.
- Workflow submissions (weldData): The result of a completed Workflow.
- This includes all Webform submissions within a single Workflow
Types of object references
Here’s a list of the different object parts that you can reference:
- Name: The name of the object.
- Slug: A string included in the URL that directs you to the object.
- EID: A unique 20 alphanumeric character ID associated with the object.
- ID: A unique numeric ID associated with the object.
Referencing Objects
Every object supports different reference types and references can be formatted as {{object.objectType}}
. For example, if you want to reference an organization's name then you would enter {{organization.name}}
in your explanation text.
Please note that the Webform editor test mode may not accurately display all object references. Instead, launch a test submission to view the result of your object references.
Here’s a full list of objects and the types of references they support:
organization.
:name
,slug
,eid
,id
weld.
(Workflow) :name
,slug
,eid
,id
forge.
(Webform) :name
,slug
,eid
,id
submission.
(a Webform’s submission) :eid
,id
weldData.
(a Workflow’s submission) :eid
,id
Webform field references
Webform field references allow you to customize your Workflows to include information that your customer input in the Webform.
If you are using a field reference in an explanation text type field, we strongly recommend referencing fields that appear in the Webform before the explanation text field. Otherwise, the reference will appear blank until information is entered in the referenced Webform field.
Webform field references can be formatted as {{forgeID:fieldAlias}}
. For example entering {{1234:shortTextFieldAlias}}
in your explanation text will display the information entered in your short text field.
Compound field references
Compound field types (e.g. Name, Address, List, etc.), support partial references. This helps if you only want to display parts of the information from a specific field.
To do this, you’ll need to specify the part you want displayed at the end of your field reference with dot notation. Here are some examples of partial field references for compound field types:
Name type fields
Allows for full name, first name, middle initial, and first and second last name references.
Field type | Reference formatting | Output |
---|---|---|
Full name | {{1234:nameAlias}} | Alex B. Chu Diaz |
First name | {{1234:nameAlias.firstName}} | Alex |
Middle initial | {{1234:nameAlias.mi}} | B |
Last name | {{1234:nameAlias.lastName}} | Chu |
Second last name | {{1234:nameAlias.secondLastName}} | Diaz |
Address type fields
Allows for full address, street1, city, state, zip, and country references.
Field type | Reference formatting | Output |
---|---|---|
Full address | {{1234:addressAlias}} | 123 Street Name, City, ST, 45678, USA |
Street | {{1234.addressAlias.street1}} | 123 Street Name |
City | {{1234:addressAlias.city}} | City |
State | {{1234:addressAlias.state}} | ST |
Zip | {{1234:addressAlias.zip}} | 45678 |
Country | {{1234:addressAlias.country}} | US |
List type fields
Allows for indexed internal field references. If a List field contains email and phone number fields, you can reference specific email or phone number information entered in the list.
Format partial list field references as {{forgeID:listAlias[indexNum].internalFieldAlias}}
. Please note that list index numbering starts at 0
, not 1
.
If you want to reference the third email in the list, you’d enter {{1234:listAlias[2].listEmailAlias}}
in your explanation text.