function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Manohar kumarManohar kumar 

prior values of a field

Hi All, i need to track a custom field fee on a case object.My goal is when i click on this fee it should disply the all previous values and the user who changged it.I enable the chatter feed for this field.What object do i have to query to get the details.How can i do this?Any help would be appreciated.

Thanks,

Manohar

Prateek Singh SengarPrateek Singh Sengar
Hi Manohar,
For the use case mentioned above a field history tracking might be a better approach. Once you have enabled field tracking on the object you can see the changes in the related list. If you have a specific requirement around mining that information you can query the objects history table.

The naming of these tables follows a simple convention so should be easy to find. For standard objects the name of the history table follows the format: 'ObjectNameHistory' so for the Account object the history table is AccountHistory

For custom objects the name of the convention simply replaces the 'c' on the end of the API name with 'History'. So, for a custom object call My_Custom_Object__c the history table is called My_Custom_Object__History
 
Manohar kumarManohar kumar

Hi Prateek thnaks for your reply.I am seeing a object called caseHistory.But their fields(newValue and oldValue) are coming empty for my caseId.Can you tell me which fields should contain the value? I am new to salesforce.Thanks in advance

Thanks,

Manohar 

Prateek Singh SengarPrateek Singh Sengar
Hi Manohar, 
The fields newValue and oldValue will contain the values, but first you need to set the field tracking on the fields you want. Also please note that this will start tracking once you have enabled the history tracking, anything changed in past will not be available.

For steps on how to enable field history tracking visit the following links

https://help.salesforce.com/apex/HTViewHelpDoc?id=tracking_field_history_for_standard_objects.htm&language=en_US
https://help.salesforce.com/apex/HTViewHelpDoc?id=tracking_field_history_for_custom_objects.htm&language=en_US