Syntax For Programming Workflow Automations

Field References

Field references are used when you need to refer to a specific value within a field. For example, in a case, you might want to refer to the Case ID or the e-mail address listed on the account linked to that case. 

Field references use square bracket notation and are always based on the workflow's native module. If you have a workflow for the Opportunities module and you want to refer to the opportunity's field opportunity stage, you would write the field reference as [opp_stage]. An account workflow can reference the account's phone number as [phone].

Sometimes it is necessary to reference fields in another module. In that case, field references can chain field names, separated by commas. As long as the record in the workflow's module has a field pointing to the specific record you wish to access, you can chain field references. 

For example, if a workflow is based on the Cases module and you want the case's account's e-mail address, you would write it as [account_id, email]. In this example, the Cases module has a standard field called Account, which is referred to using the proper field name, account_id. This contains the record ID of the account linked to the case. From there, we use the field reference chaining to refer to a field in the foreign module; the e-mail field, written as 'email'.

Field reference chains can have up to three links in them. For example, [account_id, owner, first_name] will work, but [opp_id, account_id, owner, first_name] will not. 

Field references are also used in the condition field for Workflow Conditions, in the selection field for an Edit action, or inside of calculations. They can also be used in the To, CC, or BCC fields of an E-mail action. 

Record References From Workflow Actions

Workflows can have multiple actions, including several insert actions. You may want to keep track of the record IDs of newly-inserted records created via workflow. Every record that is inserted into the system via workflow is available throughout the rest of the workflow. 

To reference this record ID, use {{record-0}}, {{record-1}}, {{record-2}}, etc. These references are tracked in the order in which the record was inserted. Even if the first insert is not the first action, it is still tracked as the first insert, {{record-0}}. If the second insert is the fifth action, it is still referenced as {{record-1}}.

Record references can be used as the first value in a field reference, or inside calculations.

NOTE: These record references i.e. placeholders are from the Workflow Action's inserts. However if your workflow is originally triggered by a "Create" action and you need to obtain the unique record id of the originally created record, use the {{inserted record}} placeholder.


Calculations can be used to specify certain mathematical actions to be performed, as well as a special 'Insert'. There are five methods that can be performed.

INSERT - Inserts the field reference, unchanged in the specified location

ADD - adds two or more field references together

SUBTRACT - Subtracts one or more field references from an initial field reference
MULTIPLY - Multiplies two or more field references together
DIVIDE - Divides one or more field references from an initial field reference

Calculations will always appear inside pairs of {{curly braces}}, similar to record references. The first argument of the calculation will always be the method. Ex: {{MULTIPLY [opp_subtotal] [opp_tax]}}

The INSERT method only takes one additional parameter: a field reference. All other methods take two or more additional parameters. All parameters, other than the method must be field references. 

If the field reference does not resolve to a number, it will be treated as a 0 for ADD and SUBTRACT, or a 1 for MULTIPLY AND DIVIDE. If only one parameter is passed to a method, it will be treated as an insert. 

Parameters inside a calculation are separated by spaces only, not commas. The only commas inside the calculation should be those inside of a field reference.

Calculations can be used in the Value field for Workflow Conditions, the value field of an Edit action, or in any field in the Create action.