24

I am coming across an underscore hd ( _hd ) object in my instance, Ive not noticed this before?

I have a custom object called Membershi__c

I also see the following to additional objects

  • Membership__History
  • Membership__c_hd

The History object I know is for file history tracking.

Does anyone know what the _hd object is, it is not query-able, I see it in the developer console object list

Thanks

2 Answers 2

18

The _hd suffix stands in for 'Historical Data'. When Historical Trending is set up for an object, the customobject__c_hd will show up in the Developer Console. There isn't much in the way of documentation on how Salesforce is handling this on the backend that I can find, just the Setup and Reporting documentation linked above.

1
  • Thanks peter, yes that looks like it. We'd enabled it in error and was consuming lost of data store.
    – dacology
    Commented Apr 1, 2014 at 14:02
9

Here is some more detail on __hd SObjects:

I enabled Opportunity with Historical trending on 2015-03-12. I took one of my Opportunities where there had been changes in Amount over time and executed this query:

SELECT ValidFromDate,ValidToDate, Amount__hpr,Amount__hst,ParentId 
   FROM Opportunity__hd where parentid = '006d000000Q0dxiAAB'

Observe the results:

enter image description here

What you see is a row for many datetime ranges reflecting changes made to the Opportunity

  • Amount__hpr is the value at the start of the Datetime range
  • Amount__hst is the value at the end of the Datetime range
  • ParentId is the parent object being tracked with historical trending

Note also that even though I enabled Opportunity with Historical Trending on 2015-03-12; SFDC went back in time and (presumably) looked at my Field History tracking to populate the rows prior to 2015-03-12

Why are there seemingly duplicate rows where the Amount didn't change from range1 to range2?

By repeating the query but this time including the other fields being tracked, we see that a row is written to Opportunity__hd every time one of the tracked fields changes. When the row is written, all of the (up to 8) tracked fields' previous/current value since the last row written are emitted in a new row.

One begins to see why SFDC limits this to up to 8 tracked fields and only up to 3 months of historical data.

SELECT ValidFromDate,ValidToDate,
       Amount__hpr, Amount__hst,
       CloseDate__hpr,CloseDate__hst,
       Forecast_Status__c_hpr,Forecast_Status__c_hst,
       ParentId 
  FROM Opportunity__hd where parentId ='006d000000Q0dxiAAB'

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .