Field History : how to detect in apex which fields are tracked?

Is there a way to access with Apex the list of the fields that are tracked in the account history?
enter image description here

I haven´t found a describe call for this purpose.

Answer

Since Winter ’16 this can be achieved using the IsFieldHistoryTracked field on FieldDefinition.

To get all tracked fields on Account you can use:

SELECT QualifiedApiName FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Account' AND IsFieldHistoryTracked = true

Attribution
Source : Link , Question Author : Enry , Answer Author : sheilak

Leave a Comment