13

I'm trying to pull the history records of a custom object with an inner query.

Here is the sample:

Select Id, Name, (Select NewValue From Custom_Object__History) From Custom_Object__c

Based on the documentation here

This should work.

example in documentation:

SELECT Name, customfield__c, (SELECT OldValue, NewValue FROM foo__history)FROM foo__c

Any help is appreciated.

Thanks,

Jonathan Jenkins
  • 667
  • 2
  • 6
  • 15
  • 2
    Using the force.com explorer I was able to find the solution.
    Select Id, Name, (Select NewValue From Histories) From Custom_Object__c
    
    

    Hope this may help anyone else with this issue.

    – Jonathan Jenkins Sep 11 '12 at 16:10

1 Answers1

22

Child history table name is common and is "histories", This SOQL should work :

Select Id, Name, (Select NewValue From Histories) From Custom_Object__c
Abhinav Gupta
  • 3,229
  • 1
  • 20
  • 31