Feed tracking and History tracking
by AR Designs
4 months ago
0
Salesforce has 2 standard/declarative options to track changes to fields over records, but there is a limit to the total number of fields you can enable under both options (which is 20 fields same for both)
Chatter Feed tracking:
This option allows you to show updates over field changes in the chatter feed of the record. This helps mainly in the collaboration between teams and to see what has been changed over the record over time.
The way it works is, once the selected fields are enabled in the feed tracking, SF detects the changes over record fields and updates them in the record feed.
Steps to Create Chatter Feed Tracking:
Go to setup in Salesforce🡪search feed tracking🡪 under chatter and click feed tracking

- To track the Task object, please select the desired object and enable the feed tracking checkbox.
- Save the settings after selecting the fields you want to track.
- Once the tracking feed page is set up and a test record is created in the Task object, you will notice no changes on the chatter page.

In the above image, the status field has a value of “in progress.” If someone modifies this field, the change will be captured in the field tracking chatter.

some of the features are:
- You can configure up to 20 fields to be shown in the record chatter feed
- You need to “enable feed tracking” in the setup for the object specifically
- Tracked feed updates that are older than 45 days delete automatically
- With this option, you don’t have a history object created but you can query the updates shared in the feed by querying feed item and feed-tracked change objects
- You can use this object for custom as well as standard objects (account, case contact, lead, and any custom, etc.)
- Field history tracking isn’t available for external objects.
Field History tracking :
- Remember this option is different from chatter feed tracking, normally people confuse them together. This option allows you to track changes over record fields in a history object. And the tracked changes can be viewed on the record detail page in history related list.
- Salesforce field history tracking is a method that can be used to track changes associated with each specific field. It can be used for both standard objects as well as custom objects that are specific to your company.
- For a particular field, the process is straightforward. The field to track is selected, and the field history is displayed in the history-based list of the object. This field history data is placed for up to 18 months through the organization and 24 months via the API.
Steps To Enable Field History Tracking:
- From Setup, click Object Manager and select any object (For ex: Employee)
- Confirm whether the track field history is enabled on the object details page.

- Select Fields & Relationships and click Set History Tracking.
- Select Enable Employee History, and then select the fields on which you want to track the changes. (You can select a maximum of 20 fields on an object)

The image demonstrates that the object’s field tracks both the old and new values, capturing all changes. However, for fields of long text data type and multi-picklist, only the changes are shown, not the field’s values. Let’s take an example to illustrate this.

In the provided image, the description field is of the long text data type. It is only captured when it undergoes a change and does not display the original and new values.
Where to see field history:
- You can check the changes for the fields on which you have enabled the history tracking by adding the object history in the related list on the object layout :
- From Setup, click Object Manager and select any object (For ex: Employee)
- Select Page Layouts, and open a page layout on which you want to show the field history.
- In the palette, click Related Lists.
- From the palette, drag the Employee History-related list onto the page layout and drop it below in the linked list section.
- Click Save.
Get the field history in your Apex code:
- You can quickly get the old value and new value of the fields on which you have enabled the history tracking using SOQL.
- For Standard Object: SELECT OldValue, NewValue, Field FROM ContactHistory
- For Custom Object: SELECT OldValue, NewValue, Field FROM Employee__History