I went to put my newly create sfdx application onto a different scratch org. It seems as if the configuration of the 'set history tracking' is not saved when you pull. I verified if I changed the setting and the pulled nothing will get pulled down. Is there a way to get this into this configuration in the sfdx project?

  • @Patlatus Doesn't the answer by Greg Cook on this version of the question provide a stronger solution?
    – David Reed
    Commented Dec 5, 2018 at 16:28
  • @DavidReed I find both answers similar and equivalent, both of them can be reduced to a single statement: either remove history tracking from xml files before pushing or do it manually or deploy it later. So they seem to be equivalent to me
    – Patlatus
    Commented Dec 10, 2018 at 8:34
  • @DavidReed Also neither of these answers is relevant anymore, since now this is not reproducible when using the latest CLI version
    – Patlatus
    Commented Dec 11, 2018 at 9:07

2 Answers 2


I was able to overcome this issue by using the metadata api features of the SFDX command line. Here is my example use case:

  • Account History Tracking needs to be enabled
  • Create your scratch org
  • Before pushing your repo into the new scratch org, run a pre-processor metadata api process. First, retrieve the metadata.

sfdx force:mdapi:retrieve -r ./scratch-mdapi-datamodel -k ./scratch-mdapi-datamodel/package.xml


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  • Edit the object.xml file for which you need to enable history tracking. You can remove all of the unnecessary XML. Here is my example file for the Account.object file:


<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
  • Deploy the contents of the object file back to the scratch org using the metadata deploy command:

sfdx force:mdapi:deploy -d scratch-mdapi-preload/unpackaged/ -w 30

  • The scratch org now has history tracking enabled for the Account and will accept your repository references for Account fields with history tracking enabled.

  • I actually put the contents of my /unpackaged/objects/Account.object into my repo and have scripted this process so that it automatically activates the feature and pushes the repo. Theoretically any other non-supported DX features could also be provisioned this way until they are officially supported by SFDX.


I have ran into this issue as well. It doesn't matter what is set to at the object level. It will not push that to a new ScratchOrg. If you have any fields with set to true you'll get an error that history tracking is not enabled at the object =.

I have had to remove the trackHistory from the field level in the hopes that when I do a metadata api push that it'll leave the value alone in the target environment.

I contacted SF support and got them to create this issue for me if you'd like to vote: https://success.salesforce.com/issues_view?id=a1p3A0000018BX2QAM



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