Find your content:

Search form

You are here

How do I query custom object history in SOQL with an inner query?


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.


Attribution to: Jonathan Jenkins

Possible Suggestion/Solution #1

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

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

Attribution to: Abhinav Gupta
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content