Loading

Cannot deploy 'Field History Tracking' using a change set

Publiceringsdatum: May 29, 2026
Beskrivning

Salesforce Change Set deployments do not support enabling Field History Tracking on object fields. If you attempt to deploy Field History Tracking via a Change Set, the deployment will not activate field history tracking in the target org.
However, you can enable Field History Tracking programmatically using the Salesforce Metadata API with tools such as:

  • ANT Migration Tool (Apache Ant-based deployment tool)
  • Visual Studio Code (VS Code) with the Salesforce Extensions and Salesforce CLI

Field History Tracking is controlled by the trackHistory metadata attribute in the custom field definition XML.

Lösning

How to Enable Field History Tracking Using the Metadata API
To enable Field History Tracking on a field, set the trackHistory element to true in your field's XML metadata definition.

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <fields>
        <fullName>MyCustomAccountField__c</fullName>
        <description>A custom field on the Account standard object.</description>
        <externalId>false</externalId>
        <inlineHelpText>Some help text.</inlineHelpText>
        <label>MyCustomAccountField</label>
        <length>100</length>
        <required>false</required>
        <trackFeedHistory>false</trackFeedHistory>
        <trackHistory>true</trackHistory>
        <type>Text</type>
        <unique>false</unique>
    </fields>
</CustomObject>

Deploy this metadata file using ANT Migration Tool or Salesforce CLI via VS Code to the target org. The trackHistory attribute is what enables the history tracking functionality.

Knowledge-artikelnummer

000384656

 
Laddar
Salesforce Help | Article