Print this page

How to capture a previous value of a field.

Knowledge Article Number 000228074
Description Can a workflow email be sent based on the previous value of a field?

Use Case: Company 'XYZ' has a contract with a customer with entitlement end date of 30/12/2015 and the end date extends for some reason to 1/1/2016.

Requirement is to send an email to the company's designated contact stating that the entitlement end date has been changed from 31/12/2015 [old close date value] to 1/1/2016 [new close date value].
Resolution Creating a Workflow Rule would help in capturing the previous value of the field.

STEP A. Creating a Text Field: Create a TEXT(255) field on the Object and name it say: Old 'Field_name' Value

STEP B. Setting up the Workflow Rule with Field Update action
1. Go to Setup | Create | Workflows & Approvals | Workflow Rules
2. New Rule
3. Select the Object
4. Click Next
5. Evaluation Criteria: created and every time it's edited
6. Rule Criteria: formula evaluates tor true
7. Formula: 
                     AND(
                           ISCHANGED('Field_name'),
                           NOT(ISBLANK(TEXT('Field_name')))
                         )
8. Click Save & Next
9. From under Immediate Workflow Actions, click Add Workflow Action to select Field Update
10. Select the Field to Update: Old Picklist Value
11. Select Use a Formula to Set the New Value
12. Formula:
                     TEXT(PRIORVALUE('Field_name'))
13. Click Save
14. Click Done
15. Click Activate

STEP C. Create an Email template with merge fields including 'Field_name'  and Old 'Field_name' Value in the template text body, these fields will be replaced with information from your records. 

Example :
The entitlement end date has been changed from 31/12/2015 [old close date value] to 1/1/2016 [new close date value].




promote demote