Field History Tracking
Contents
[NOTE] Updated February 22, 2020. This article may have outdated content or subject matter.
In today’s article, the concept of field tracking will be discussed in detail. So what is field history tracking on the Salesforce platform? this feature allows the system to maintain a current and previous value for a given field on an object, given that the field data type permits it. In laymen terms, Field History tracking is a method where we can track the changes that happen to a field. Field history tracking can be done for both custom and standard objects.
Whenever a user modifies any of the fields selected for tracking, the old and new field values are added to the History related list as well as the date, time, nature of the change, and user making the change. Note that multi-select picklist and large text field values are tracked as edited; their old and new field values are not recorded.
You can select certain fields to track and display the field history in the History related list of an object. Field history data is retained for up to 18 months through your org, and up to 24 months via the API. Not all field types are available for historical trend reporting. Certain changes, such as case escalations, are always tracked.
Objects Trackable
Field history tracking is possible for all custom objects and the following standard objects. - Accounts - Articles - Assets - Campaigns - Cases - Contracts & Contacts - Contract line items - Entitlements - Leads & Opportunities - Orders & Order products - Products & Price book entries - Service Contracts & Solutions
Field history tracking considerations
Please consider the following considerations for field history tracking: 1. Changes to time fields are not tracked in the field history related list 2. Changes to date fields, number fields, and standard fields are shown the locale of the user viewing the history 3. If a trigger causes a change on an object the current user doesn’t have permission to edit, that change is not tracked. Field history honors the permissions of the current user. 4. Tracked field values are not automatically translated; they display in the language in which they were made. 5. Changes to fields with more than 255 characters are tracked as edited, and their old and new values are not recorded.
EntityHistory
The EntityHistory object is the underlying object used in field history tracking, it represents all the historical information about an object’s changed field values. Note, this object is only available to users with the “View All Data” permission.
Field | Description |
---|---|
ParentSobjectType | Kind of object containing the field |
ParentId | ID of the object that contains the field |
OldValue | previous value of the modified field |
NewValue | Current value of the modified field |
IsDeleted | Indicates if the object is recycled |
FieldName | ID of the field changed |
EntityHistory Notes
- Deleting a custom field also permanently deletes the history data for that custom field
- Turning off the tracking for a field stop further changes being recorded, however, the history data is maintained.
- As soon as tracking is enabled for a field, all changes to its value are recorded.
- A total of 20 fields(standard | custom) can be tracked.
Code Example
Assume that a field called Date_Entryc was added on Essencec and field history tracking was enabled.
|
|
Author Remario Richards
Modified February 22, 2020