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
tomh.ax1293tomh.ax1293 

How to tell which fields have history tracked for them.

I'm wanting to progammatically work out which fields (so names and types) will be available in the Field column of the History object for a table.

 

There doesn't seem to be anything on 

com.sforce.soap.partner.Field

 

Also how do I work out what the History sObject for an sObject is?

 

Thanks

 

 

MarceldeBMarceldeB
Hi TomH, did you ever find a solution on your first question (ie determine which fields are history tracking enabled)?
Regards, Marcel.
tomh.ax1293tomh.ax1293

Kind of - the history SObject has a fairly predictable name from its source table (except in a few special cases), and it seems to contain all meaningfull fields.

MarceldeBMarceldeB

Hi Tom, thanks for your reply.

I think I don't really understand. you point at the sObject with the history date, eg. MyObject__history.

with schema.myObject__history.SObjectType.getDescribe().fields.getMap() I can get a list of the fields of this history object, but these are: Field, Createddate, OldValue, NewValue etc.

 

What I am searching for (and I thought to read you were searching for too) is to find out which of the fields of my object (MyObject__c) itself have been selected for history tracking.

Did you indeed find something for that? If so, you would really help me with some hints!