I think what you want is to track History of Case Owner ( Referene to User Object) , that is a User Object records. It is not possible to enable history on User Object. No History tracking is Available on User Object.
You have to Create Your Own History Tracking Frame work for that Creating a CopyOfUser__c Custom Object and writting triggers on User Object.
One Easy Way to Achive this Can be
1)Create a New Object CopyOfUser__c and Create fields Similar to User Object on it. Only Create those field that you want to track History. Enable History on this Object Fields. And Keep a reference field Master Detail to User as well.
2) Write a trigger on User after inser and after update. After insert it should create a record of UserHistory__c and after update it should copy appropriate field from user to CopyOfUser__c.
Now as you have Enabled History tracking on UserHistory__c, after every update on User , corresponding history can be tracked from History of this Custom Object CopyOfUser__c .
Also, I recommend you download and install the Force.com Explorer or Force.com plugin for Eclipse. These tools allow you to view the schemas of all tables used in your org, including the history tables for standard and custom objects. Very useful for playing around with SOQL queries.
Thank you,
That is what I have been looking for. The documentation never mentions how to get the history table.
All Answers
Hey,
You need to check if the history of the case owner field on the case object is selected or not. You can check it here
AppSetup--> Customize--> Cases-->fields--> Set history tracking
Yes the history tracking is enabled. It shows up nicely in the history listing. I checked the tracking setting as well.
I think what you want is to track History of Case Owner ( Referene to User Object) , that is a User Object records. It is not possible to enable history on User Object. No History tracking is Available on User Object.
You have to Create Your Own History Tracking Frame work for that Creating a CopyOfUser__c Custom Object and writting triggers on User Object.
One Easy Way to Achive this Can be
1)Create a New Object CopyOfUser__c and Create fields Similar to User Object on it. Only Create those field that you want to track History. Enable History on this Object Fields. And Keep a reference field Master Detail to User as well.
2) Write a trigger on User after inser and after update. After insert it should create a record of UserHistory__c and after update it should copy appropriate field from user to CopyOfUser__c.
Now as you have Enabled History tracking on UserHistory__c, after every update on User , corresponding history can be tracked from History of this Custom Object CopyOfUser__c .
Are you sure that I really need to do this dance with the CopyOfUser__c object?
But still how do I access the history field ot the custom object.
There must be a query that I can run.
Someting like "Select value1, value2 from history_somefield"
/Martin
Have you tried the CaseHistory table?
Assuming you have history tracking on the Case Owner field enabled, then you can do:
select NewValue, OldValue, CreatedDate from CaseHistory where CaseId=:case.Id and Field='Owner'
Thank you,
That is what I have been looking for. The documentation never mentions how to get the history table.
No worries.
Also, I recommend you download and install the Force.com Explorer or Force.com plugin for Eclipse. These tools allow you to view the schemas of all tables used in your org, including the history tables for standard and custom objects. Very useful for playing around with SOQL queries.