Referencing Old Record Values in a Workflow
Even when a workflow changes a record's values, it's possible to create workflow initiation, action, or transition conditions that reference record values before the changes occurred. The record's original values are retrieved before the first Before Submit event executes. These values can then be used in Before Submit and After Submit workflow, action, and transition conditions. To do this, use the Old Record option in Record field when defining a condition using the Condition Builder. For more information, see Defining a Condition with the Condition Builder.
Old Record Guidelines
Use the following guidelines when using Old Record values for a record.
-
Use this feature only when necessary. Referencing Old Record values reduces workflow performance because the workflow needs to load the old record from the database.
-
Use a Before Record Submit or After Record Submit trigger when referencing pre-edit values.
-
Use a Before Record Submit or After Record Submit trigger when referencing Old Record values.
-
If you want to reference a field of the old record in a condition represented by a formula, the placeholder old needs be used. For example, Old Record:Priority (Task/Call) = High would be represented as {old.priority.id}=’HIGH’.
Example of Reacting to a Change in a Field
A common use case for referencing old values in a workflow is reacting to a change in a field on a record. In this situation, you would create a condition similar to Old Record.Some Field != Some Field.
For example, consider a task record that is running an approval workflow. To expedite the approval, a user can set the Priority field to High and the workflow can be configured to react to this field's value. To notify the approver, we can use the Old record option and send an email to the approver only when the Priority is raised to High or set to High when the task record was created. To do this, you create a Send Email action with a condition using the Priority field.
To create the example Send Email action:
-
Select an existing workflow flow state or add a new workflow state to the workflow.
-
Click New Action in the Context Panel.
-
Click Send Email.
-
Set the following action properties:
-
Trigger On – After Record Submit
-
Condition:
Custom Formula – Selected
Condition –
{old.priority.id} != {priority.id} and {priority.id} = 'HIGH'
-
Sender:
-
Specific Sender – Selected
-
Sender – Specify a sender
-
-
Recipient
-
From Field – Selected
-
Record (Join Field) – Current Record
-
Field – Assigned
-
-
Content
-
Custom – Selected
-
Subject – Your task has been escalated!
-
Body – Your task ‘
{title}
’ has been escalated to High priority!
-
-
-
Click Save.
It is also possible to create the condition's formula using the Visual Builder. In this example, the formula would be Old Record : Priority (Task/Call) != Priority (Task/Call) And Priority (Task/Call) = High
.