Sunday 26 October 2014

Tracking Field History in Salesforce through SOQL and UI

Tracking Field History


You can select certain fields to track, and display the field history in the History related list of an object. You can track the field history of custom objects, as well as the history of the following standard objects:

§  Accounts
§  Cases
§  Contacts
§  Entitlements
§  Service contracts
§  Contract line items
§  Contracts
§  Leads
§  Opportunities
§  Articles
§  Solutions


To track field history for custom objects and standard objects.

1.      From Setup, click Create | Objects.
2.      Click Edit next to the name of the custom object.
3.      Select the Track Field History checkbox

  When you enable tracking for an object, be sure to customize your page layouts to include the object’s history related list.

4.      Click Save.
5.      Click Set History Tracking in the Custom Fields & Relationships section.
This section allows you to set a custom object’s history for both standard and custom fields.
6.      Choose the fields you want tracked.
You can select up to 20 standard and custom fields per object. You can’t track:
§  Formula, roll-up summary, or auto-number fields
§  Created By and Last Modified By
7.      Click Save.
Salesforce tracks history from this date and time forward. Changes made prior to this date and time are not included.



 SOQL to Track History.


Select Amount, leadsource, (Select OldValue, NewValue From histories) From Opportunity


SELECT name,CreatedDate,Fees__c,languages__c,(select field,oldvalue,newvalue from histories) FROM student__c

Custom Object:





Standard Object:



No comments:

Post a Comment

Complete Salesforce CPQ training Free videos

Salesforcestart:: We are excited to announce that our YouTube channel, Salesforcestart, is your one-stop-shop for all things Salesforce CPQ!...