Tracking field history is an out-of-the-box feature to track value changes in a field. You can select certain fields to track and display the field history in the History related list of an object. The field history data is retained for up to 18 months. Note that Long text area, Rich text area, and Multi-select Picklist fields are tracked as edited, but their old and new field values are not captured when the record is updated. History tracking capture the following information:
- Prior value
- Current value
- Who has done the changes
- When it was changed
Let’s start with a business use case.
Business Use case :- Pamela Kline is working as System administrator in Universal Container. She has received a requirement to enable field history tracking for multi-select picklist (Country on Lead object), also capture their old and new field values.
Solution of above business requirement
There are few possible solutions for the above business scenario, but we will use the Process Builder to solve this, without writing a single line of code. Follow the below instructions to create a custom object and Process for the above business requirement.
1. First of all create a new custom object Country history tracking and few custom fields as Shown in the following screenshot.
- Organization-Wide Defaults :- Public Read Only
- Field-level Security :- View
- Object-level Permission :- Read
- Remove Edit and Del button from the page layout
2. The next step is to create a Process on Lead object. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and then click on the Save button.
3. The next step is to add entry criteria. For this click on Add Object, select Lead object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button.
4. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Lead].Country__c IsChanged Boolean True as shown in the following screenshot.
5. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Create a Record), and then fill out the fields to define the action, as shown in the following screenshot.
For Action use the following formula
'Changed' & ' '&'from' &' '& PRIORVALUE([Lead].rakeshistomMVP__Country__c ) & ' '&'to' & ' '& IF( INCLUDES([Lead].rakeshistomMVP__Country__c , "India"), "India; ","") &IF( INCLUDES([Lead].rakeshistomMVP__Country__c , "USA"), "USA; ", "")& IF( INCLUDES([Lead].rakeshistomMVP__Country__c , "UK"), "UK; ", "") & IF( INCLUDES([Lead].rakeshistomMVP__Country__c , "France"), "France; ", "") & IF( INCLUDES([Lead].rakeshistomMVP__Country__c , "Russia"), "Russia; ", "")
6. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot.
Don’t forget to active the Process by clicking on the Activate button.
It’s time to test this feature
Navigate to the Lead tab, identify the Lead record and click on Lead Name to open record detail page. Now modify Country picklist field value
Note :- Field Audit Trail gives you the ability to track 3x more fields (60 fields total) in a Force.com production org and control how long those field history records are retained in the org before being archived to longer-term storage:
- Maximum time to retain field history records in production org is 18 months
- Overall maximum time to retain a field history record is 10 years
- Up to 60 fields per object may be selected for tracking changes
Check out this article for more information.
P.S. :- I will suggest you to implement this first on your developer org, test it and then move it to production.