How to Enable Field History Tracking in Salesforce | How to Setup Field History Tracking in Salesforce

In this Salesforce tutorial, we are going to learn about enabling or setup a Field History tracking in Salesforce Lightning and Classic editions. We will discuss setting field history tracking for standard and custom objects in both editions. We will learn about the Field History Tracking feature and its uses in Salesforce.

There are some considerations for using field history tracking and we will discuss that also. To track history tracking in custom objects, we will create a custom object from scratch to enable and set up field history tracking.

While working as a system administrator for an organization that uses Salesforce as its primary CRM tool, I was asked to set field history tracking for the standard “Opportunity” object to track specific field changes related to sales team activity and opportunity updates. So I decided to set field history tracking by editing the settings of the object.

Field History Tracking in Salesforce

In Salesforce Field History Tracking is a feature that allows us to track the history of the modifications and changes made in the specific fields of objects. In enabling field history tracking, we select specific fields in the objects to set up the field history tracking. Every object has a limit for the number of fields to set up field history tracking.

We can track the field history of the following Standard and Custom objects in Salesforce.

  • Accounts
  • Articles
  • Assets
  • Campaigns
  • Cases
  • Contacts
  • Contracts
  • Contract Line Items
  • Crisis
  • Employees
  • Employee Crisis Assessments
  • Entitlements
  • Events
  • Individuals
  • Internal Organization Units
  • Knowledge
  • Leads
  • Opportunities
  • Orders
  • Order Products
  • Products
  • Price Book Entries
  • Quote
  • Quote Line Item
  • Service Appointments
  • Service Contracts
  • Solutions
  • Tasks
  • Work Orders
  • Work Order Line Items

Considerations

We have to consider the following points while using field history tracking in Salesforce.

  • We cannot track the field history of the fields that we edited or added prior to enabling field history tracking.
  • The changes made in the fields with more than 255 words like the Long text field can’t record the old value and new value.
  • If two users update the same tracked field on the same record at the same time, both updates have the same timestamp. The order of these changes to the database can be random and this can result in display values looking out of order.
  • In case, you have to retrieve field history that is older than 1.5 – 2 years, use Data Loader or the¬†queryAll()¬†API to retrieve or track field history.
  • A field history tracking record cannot be deleted.
  • In tasks and Events, we can set up field history tracking for a maximum of 6 fields.
  • Unlike Salesforce Lightning, the history list of tracking is not available in Salesforce Classic.
  • There is a limit to setting field history tracking for up to 20 fields for each standard and custom object.
  • Object fields having decimal values, like currency and percent, are not supported to be displayed in history tracking.

Field History Tracking Setup for Standard Objects

To Set up Field History Tracking for Standard Objects we will edit the settings of existing standard objects. In the examples, I have selected the object Opportunities, and you can follow the same procedure to set up field history in any standard object.

Set Up Field History Tracking for Standard Objects in Salesforce Lightning

To set up Field History Tracking for Standard Objects in Salesforce Lightning, navigate to the Setup page of Salesforce Lightning and follow the below.

1. On the Setup page of Lightning, click on the Object Manager tab.

Field History tracking Setup for Standard Object in Salesforce Lightning

2. In the Object Manager setup, select an object from the list of objects. In this example, I have selected a standard object Opportunity.

Setup field history tracking in Salesforce

3. In the Opportunity object window click on the Fields & Relationships in the Details section and then click on the button Set History Tracking.

Salesforce enable field history tracking in Lightning

4. In this step, go to the section Track old and new values and activate the fields that you want to track on the opportunity history-related list. After selecting the fields click on the Save button.

Setup field history tracking in Salesforce Lightning

5. Now back in opportunity setup, click on Page Layouts under the heading Details, and then in the Page Layouts select the main page layout of the object.

Salesforce Lightning enable field history tracking

6. In the edit window of the Page Layout, first click on the Related Lists and then drag the Opportunity Field History to the Related Lists section below.

At last click on the Save button to apply these changes to the page layout.

Salesforce Lightning setup field history tracking

7. Now go to the object and make changes to the fields in which you have set up the field history tracking. In this example, I have set field history tracking in the Opportunity object.

I have made changes in the order number field of opportunity to check if these changes are reflected in the field history or not.

Salesforce setup field history tracking in Lightning

After saving the changes, go to the section Opportunity field history, and you can see the history of changes made in the field.

Enable field history tracking in Salesforce Lightning

In this way, we have successfully set or enabled field history tracking in Salesforce Lightning using the opportunity object.

Set Up Field History Tracking for Standard Objects in Salesforce Classic

To set up field history tracking in Salesforce Classic, first log in to your Salesforce developer account and follow the steps below. In this example, I will explain how to set up field-level tracking in the Lead object.

1. On the Home page of Salesforce Classic click on the Setup tab, which is on the upper right side of the screen.

Setup field Level tracking in Salesforce Classic

2. In the Setup page of Classic, go to the Build section on the left-hand side and select Customize -> Leads -> Fields.

Enable field history tracking in Salesforce Classic

3. In the Leads fields, click on the button Set History Tracking.

Set History Tracking in Salesforce Classic

4. In this step, first activate the checkbox Enable Lead History and then go to the section Track old and new values and activate the fields that you want to track in the Lead History related list. After selecting the fields, click on the Save button to apply changes.

Salesforce Classic Setup Field History tracking

5. After enabling the field-level tracking, go to the Page Layouts in the Leads object to add this field history tracking section to the leads page.

Field History tracking in Salesforce Classic

8. In the Page Layouts, click on the Edit button of the page layout that is in use.

Set field Level tracking in Salesforce Classic

9. In the Edit window of Page Layout, go to the left side scroll bar and select Related Lists. Now drag the Lead History field to the Related Lists section, and click on the Save button to apply changes in the Page Layout.

Salesforce Classic Enable Field History tracking

10. Since I have set up history tracking in the Leads object, I will go to the leads and make changes in the field that I have selected above to track Field history.

In this example, I have made changes in the selected field Industry to check it reflects the changes in the field history of the Lead.

Salesforce setup field history tracking in Classic

After saving the changes, go to the Lead History section, and under the column Action, we can see the history of the changes made in the lead.

Salesforce Classic Enable Field History tracking in Object

In this way, we have successfully enabled and set up field history tracking in Salesforce Classic with the help of the above steps.

Field History Tracking Setup for Custom Objects

To set up field history tracking, we will create a custom object and while setting up the custom object we will enable the field history tracking.

Set Up Field History Tracking for Custom Objects in Salesforce Lightning

To Set Up Field History Tracking for Custom Objects, we need to first create a custom object and for that follow the below steps.

1. To create a custom object, go to the Setup page of Lightning and click on Object Manager.

Field History tracking Setup for Custom Object in Salesforce Lightning

2. In the Object Manager, click on the Create button dropdown -> select Custom Object.

Field History tracking for Custom Object in Salesforce Lightning

3. In the Custom Object window, go to the Custom Object Information section and enter the object name in the Label field and the plural form of the object name in the Plural Label field.

Salesforce Lightning enable field history tracking in Custom Object

4. Now scroll down to the same window and activate the checkboxes Allow Sharing, Allow Activities, and Track Field History.

Activate the radio button Deployed and checkbox Allow Search and click on the Save button.

Setup field history tracking for custom object in Salesforce Lightning

After this, we need to add some fields in the custom objects to select those fields in tracking. You can follow this tutorial to see how to add fields to objects in Salesforce.

5. Go to the setup of the custom object in the Object Manager and in the Details section click on Fields and Relationships, and on the right side, click on the button Set History tracking.

Salesforce Lightning setup field history tracking in Custom Object

I have added custom fields Mobile, Survey Type, Email, and Customer Survey Review in this object. Since Survey review is a long text field, it is in the section Track Changes only, because in field tracking we can’t track old and new values of the long text field.

6. Activate the checkboxes of the fields that you have to track and click on the Save button.

Salesforce Lightning Field History Tracking for Custom Objects

7. Back to the Setup of the custom object, click on Page Layouts, then in Page Layouts click on the page layout of the object that is in use.

Set field History tracking for custom object in Salesforce Lightning

8. In the Page layout click on the Related lists in the scroll bar on the top then drag the field (object name) history component to the Related list section, and click on the Save button.

Enable and Setup field History tracking for custom Object in Salesforce

Now we need to add this object in the tab otherwise it will not be visible in the App Launcher and tabs. To add this object in tabs, follow the article link How to add and remove tabs in salesforce lightning.

7. Go back to the Setup page of Lightning, and click on App Launcher to search for the custom object that you have set up. I will search for the custom object Customer Surveys, that I have created in the above steps.

Salesforce Lightning Field History Tracking Setup for Custom Object

8. In the Custom object click on the New button and create a new record for the Customer Surveys (Custom Object).

9. After creating and saving that record in a custom object, again open that record and change the fields. In this example, I have changed the fields Mobile, Survey type, and Customer Survey Review.

10. After making these changes, save them and go to the section Customer Survey History section and we can view the changes we have made in the fields.

Salesforce enable field history tracking for Custom Objects in Lightning

In the long text field Customer survey it is showing blank in the Original Value and New Value column because field history tracking does not track original and new value for the long text field.

In this way, we have successfully enabled and set up field history tracking for custom objects in Salesforce Lightning.

Set Up Field History Tracking for Custom Objects in Salesforce Classic

To set up Field History Tracking for Custom Objects in Salesforce Classic, switch to the Classic edition and follow the steps below.

1. On the Home page of Salesforce Classic, click on the Setup tab that is on the upper right side of the screen.

Setup field history tracking for custom object in Salesforce Classic

2. In the Setup page, go to the Build section in the left sidebar, click on the dropdown Create, and select Objects.

Salesforce Classic Setup Field History tracking for Custom Object

3. In the Custom Objects window, click on the button New Custom Object.

Salesforce Custom object with enabled field History tracking

4. In the New Custom Object window, go to the section and enter the below fields.

  • In the Label enter the name of the custom object.
  • In the Plural Label field enter the plural form of the object name.
  • Add a description of the custom object in the description box.
Set field Level tracking for custom object in Salesforce Classic

5. Now scroll down on the same page and in the section Optional Features and activate the checkboxes Allow Reports, Allow Activities, and Track Field History.

After this, select Deployment Status as Deployed and activate the checkbox Allow Search to make this object appear when searched and after at last click on the Save button.

Set field History tracking for custom object in Salesforce Classic

After creating a custom object, we need to add some fields in the custom object to set those fields in the field tracking. To add fields to custom objects in Salesforce, follow the tutorial link How to Create a Custom Object in Salesforce.

6. To set field history tracking on this page, navigate to the Setup page of Classic, and in the Build section select Customize -> Topics -> Objects.

Salesforce Classic Enable Field History tracking in Custom Object

7. In the Custom Objects window, click on the Edit button of the custom object in which you have to set up field history tracking. I have selected the custom object Property Listing in this example.

Setup field history tracking in Salesforce Classic

8. In the edit window of the custom object, go to the section Custom Fields & Relationships and click on the button Set History Tracking.

Set History Tracking for Custom object in Salesforce Classic

9. In this step, activate the checkboxes of the fields that you have to track in history and click on the Save button. In this example, I have selected the fields Address, Listing type, Email, and Mobile.

We can only track the fields that we have activated in this step.

Track Field History of Custom Objects in Salesforce Classic

10. Go back to the edit window of the custom object and in the section Page Layouts click on the Edit button of the page layout that is in use.

Salesforce Classic Enable History tracking in Custom Object

11. In the edit window of the page layout, select Related Lists in the side scroll bar and drag the component Property listing history to the Related Lists section on the page layout.

Salesforce Classic Setup History tracking for Custom Object

12. Go to the custom object tab and select the record in which you have to check field history tracking.

Salesforce Classic Enable Field History tracking For Custom Objects

13. After selecting the records, edit the values of fields and click on the Save button.

Change fields to check history tracking in Salesforce Classic

14. On the record page, go to the section (object name) History section, and there you can view the field history tracking as shown in the below picture.

Field History tracking for Custom Object in Salesforce Classic

Now we have successfully enabled and set field history tracking for custom objects in Salesforce Classic.

Conclusion

In this Salesforce tutorial, we have learned about enabling and setting field history tracking for standard and custom objects in Salesforce Lightning and Classic editions. After setting field history tracking for the standard objects we also checked its working after making changes in the fields. Along with this we also learned to set up a custom object in Salesforce Lightning and Classic editions.

You may like to read: